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!

accessing mysql connect-j from inside a jar file

843859Dec 30 2006 — edited Jan 2 2007
Hi all,

I have a simple java application which successfully makes a connection to a MySQL database (5.0) using the Connector/J jar file (3.0).

However when I place the application into a jar file, a class not found exception is thrown when attempting to instance the driver using:
Class.forName("com.mysql.jdbc.Driver").newInstance();

I have tried specifying the class path to the Connector/J jarfile both in my jar's manifest and on the command line ( using "java -classpath .;lib\mysql-connector-java-3.0.17-ga-bin.jar -jar bin\DatabaseTest.jar" ), but to no avail.

Any ideas where I'm going wrong?

Thanks...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 30 2007
Added on Dec 30 2006
4 comments
373 views