Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Class.forName() and java 6

843859Feb 6 2008 — edited Jan 14 2015
I have a java project in Eclipse and I'm using MySQL connector form MySQL site (mysql-connector-java-5.1.5) as far as I know it supports JDBC 4
Beacuse Java 6.0 does not need explicit loading of the driver I've commented
//Class.forName("com.mysql.jdbc.Driver");
part of my code but now it does'n work.
I get this SQLException "No suitable driver found for jdbc:mysql:localhost......"
The mysql-connector-java-5.1.5.jar is in "Reference Libraries" in my project and the the complier is set to Java 6.0.

The stangest thing is that this code(with Class.forName commented) worked whe I had NetBeans installed so I suspect that maybe it registred mysql connector globally somehow.

Is there something tham I'm missing in configuration ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 27 2008
Added on Feb 6 2008
17 comments
370 views