Results 1 to 3 of 3
  1. #1
    geekchick is offline Member
    Join Date
    Aug 2010
    Posts
    25
    Rep Power
    0

    Default No suitable driver found

    Hi,

    I'm kind of stuck. I'm trying to connect to a mysql database through Netbeans and am getting the following error:

    No suitable driver found

    What could I be doing wrong?

    Java Code:
    public class Main {
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) throws Exception
        {
            Class.forName("com.mysql.jdbc.Driver");
            Connection con = DriverManager.getConnection("jdbc:mysql//localhost/employee_record", "root","password");
            PreparedStatement statement = con.prepareStatement("select * from employee");
            ResultSet result = statement.executeQuery();
            while(result.next())
            {
                System.out.println(result.getString(1) + "" + result.getString(2));
    
            }
            
        }
    
    }

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    4

    Default

    You're missing the ":" after "mysql" in the getConnection line.

  3. #3
    geekchick is offline Member
    Join Date
    Aug 2010
    Posts
    25
    Rep Power
    0

Similar Threads

  1. Replies: 6
    Last Post: 09-01-2010, 11:29 AM
  2. What layoutmanager is suitable for forms.
    By Somelauw in forum AWT / Swing
    Replies: 9
    Last Post: 12-05-2009, 01:04 PM
  3. Which is the most suitable IDE ?
    By javaamateur in forum NetBeans
    Replies: 2
    Last Post: 10-11-2009, 11:21 AM
  4. Replies: 13
    Last Post: 03-16-2009, 09:37 PM
  5. What database is more suitable to a java app?
    By hittite in forum New To Java
    Replies: 6
    Last Post: 11-14-2008, 04:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •