Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC MySql Driver problem

 
zack chancery
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help,
I downloaded a mySql Driver that comes in the form of a jar file called mysql-connector-java-3.0.15-ga.jar. i saved it in the jre/lib/ext dir of my j2sdk as is advised but when i try and load it in my program i get an exception. when i print the stackTrace for the exception this is returned:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:162)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at Teller.<init>(Teller.java:53)
at Main.init(Main.java:20)
at sun.applet.AppletPanel.run(AppletPanel.java:353)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.io.FileNotFoundException: H:\project\com\mysql\jdbc\Driver.class
(The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection
.java:69)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLCon
nection.java:156)
at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:274)
at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:43)
at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:152)
at java.security.AccessController.doPrivileged(Native Method)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:149)


regards,
z
 
David Ulicny
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe is problem in applet security.

What mean this part of your stack trace?

Caused by: java.io.FileNotFoundException: H:\project\com\mysql\jdbc\Driver.class
(The system cannot find the path specified)
 
sai Narayan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
try setting the classpath as:-
C:\> set CLASSPATH=\path\to\mysql-connector-java-[version]-bin.jar;%CLASSPATH%
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic