Results 1 to 4 of 4
  1. #1
    Jack_Tauson_Sr is offline Senior Member
    Join Date
    Nov 2011
    Posts
    102
    Rep Power
    0

    Default Error in JDBC Connection !

    Hi
    I'm simply trying to JDBC connect to mysql 5.5 from Net beans.

    I'm trying to insert values from my java code in net beans to the table created in mysql.

    Here is the error I'm getting:

    "
    java.sql.SQLException: No suitable driver found for jdbc:mysql//localhost/midb? "


    Where midb is the database name I have created in MySQL 5.5.

    Here is the connection string I'm using under try block :
    "
    Connection conn = DriverManager.getConnection("jdbc:mysql//localhost/midb?"); "


    AdditionalInformation:

    Here is how I login to MySQL 5.5

    I just need to enter my password and I can login easily.


    Please help !

    ================================================== ================================================== ==
    Here is the code I'm using:



    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */
    package javajdbc;

    /**
    *
    * @
    */
    import java.sql.*;

    public class JavaJDBC {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    try{
    Class.forName("com.mysql.jdbc.Driver");
    Connection conn = DriverManager.getConnection("jdbc:mysql//localhost/midb?");
    Statement st = conn.createStatement();
    st.executeUpdate("INSERT INTO PERSONA VALUES('John','Jack','Stephen'");


    }
    catch (Exception e)
    {
    System.out.println(e);


    }
    }
    }

    Here is the actual errorshown in Net Beans:

    run:
    java.sql.SQLException: No suitable driver found for jdbc:mysql//localhost/midb?
    BUILD SUCCESSFUL (total time: 1 second)

  2. #2
    kkji is offline Member
    Join Date
    Aug 2011
    Posts
    54
    Rep Power
    0

    Default Re: Error in JDBC Connection !

    check your driver for mysql available in netbeans.

  3. #3
    kkji is offline Member
    Join Date
    Aug 2011
    Posts
    54
    Rep Power
    0

    Default Re: Error in JDBC Connection !

    If not in your web application libraries keep mysql-connector-java-xxxxx.jar file.

  4. #4
    Spritexxx is offline Member
    Join Date
    Nov 2011
    Posts
    1
    Rep Power
    0

    Default Re: Error in JDBC Connection !

    You must download J connector:

    MySQL :: Download Connector/J

    Then you should unpack the downloaded filesomewhere you choose and look for a jar file named: mysql-connector-java-5.1.18-bin.jar. Remember where that file is located!

    Then right click on your project (in which you want to use your sql queries) in netbeans, and go to the properties of the project.
    In the properties choose the libraries tab and press the add jar file button. Select your mysql-connector-java-5.1.18-bin.jar file and add it.

    Now it should work!

Similar Threads

  1. protocol violation error in jdbc connection
    By ronbigman in forum JDBC
    Replies: 0
    Last Post: 05-03-2011, 08:58 AM
  2. Help! JDBC Connection Error
    By pryncipe in forum New To Java
    Replies: 5
    Last Post: 03-19-2011, 04:03 PM
  3. JDBC connection to Cache - error
    By javavick in forum New To Java
    Replies: 1
    Last Post: 05-06-2010, 02:06 PM
  4. Error creating JDBC connection in Eclipse
    By tascoa in forum Eclipse
    Replies: 2
    Last Post: 11-06-2009, 10:20 AM
  5. Help me this error in JDBC-ODBC connection
    By lordelf in forum Java Servlet
    Replies: 3
    Last Post: 04-04-2009, 08:37 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
  •