If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > HELP: connect to mysql with java

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-01-04, 08:22
jjs jjs is offline
Registered User
 
Join Date: May 2004
Posts: 2
Unhappy 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
Reply With Quote
  #2 (permalink)  
Old 05-04-04, 08:37
J.D. J.D. is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 05-22-04, 10:04
jjs jjs is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On