Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Posts
    2

    Unhappy Unanswered: HELP: connect to mysql with java

    i have problems to connect to mysql-db with java. mysql is running on the same pc like i try to connect
    i use the following driver: mysql-connector-java-3.0.11-stable.zip which is included in the project (i use eclipse)

    part of my code to connect:
    ...
    Class.forName("com.mysql.jdbc.Driver").newInstance ();

    String url = "jdbc:mysql://localhost:3306/testdb";
    Connection con = DriverManager.getConnection(url);
    ...

    this is the error message:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    java.sql.SQLException: No suitable driver

  2. #2
    Join Date
    May 2004
    Location
    NJ USA
    Posts
    21
    You have to include the Driver's jar file in the CLASSPATH.
    J.D.
    Database Administrator

  3. #3
    Join Date
    May 2004
    Posts
    2

    Thumbs up

    J.D:

    thanks very much for the tip. i changed the drivers .zip file into a .jar and it works.

Posting Permissions

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