Bug #15043 Need to extract .jar to work "ClassNotFoundException: com.mysql.jdbc.Driver"
Submitted: 18 Nov 2005 7:46 Modified: 31 Mar 2014 10:00
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.1 OS:Linux (Linux)
Assigned to: Alexander Soklakov CPU Architecture:Any

[18 Nov 2005 7:46] [ name withheld ]
Description:
I have this problem with the actual 3.0 and 3.1 versions of the JDBC driver and found others to have it on the internet.  The others would simply download a different version of the Driver.

If I use the binary version of the driver, it will only work if I 'unbundle' the classes.  It won't work if I don't unbundle the classes.

My JDK is Sun 1.5

Bundled or unbundled, the imports work fine.  My test code is a trivial connection.

How to repeat:
Install Sun JDK 1.5
Download mysql-connector-java-3.0.17-ga.tar.gz (or the 3.1)
Untar the mysql-connector-java-3.0.17-ga.jar
write a trivial Test.java
$javac Test.java -cp `pwd`/mysql-connector-java-3.0.17-ga.jar
$java Test
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
java.sql.SQLException: No suitable driver

Suggested fix:
Take a look the Jar unpacking, or the other jdbc bug that references a problem with the Sun compile.
[4 Dec 2005 17:33] Aleksey Kishkin
hi! You should set classpath for java also (not only for javac).

Could you try 
$javac Test.java -cp `pwd`/mysql-connector-java-3.0.17-ga.jar
$java Test -cp `pwd`/mysql-connector-java-3.0.17-ga.jar

and check if it works?
[5 Jan 2006 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[2 May 2006 8:47] [ name withheld ]
Even if I set the class path I get the same problem "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver". This happens only with the Connector/J 3.1.x version and not with the Connector/J 3.0.x version. Everything was working find with older version, since stored procedure was implemented only in new version I switched. But new version doesn't even connect to DB.

Please suggest some fix
[18 May 2006 21:32] Valeriy Kravchuk
Please, try to repeat with latest version, 3.1.12, and inform about the results.
[7 Jun 2006 6:35] [ name withheld ]
Hi, with this version 3.1.12, the exception is solved. But, in the class path, I have to specify, not only the path to the *.jar file but also, put the *.jar file name... I mean path/to/jar/<filename.jar>. Then only it works.
Thank you very much for replying
[18 Jun 2006 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[31 Mar 2014 10:00] Alexander Soklakov
Fixed in 3.1.12