Reputation: 1425
how to solve the following problem...
java.lang.ClassNotFoundException: mysql-connector-java-3.1.14-bin at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:188) at
java.lang.ClassLoader.loadClass(ClassLoader.java:307) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at
java.lang.ClassLoader.loadClass(ClassLoader.java:252) at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at
java.lang.Class.forName0(Native Method) at
java.lang.Class.forName(Class.java:169) at
com.myeclipseide.ws.FirstExample.main(FirstExample.java:20)
My JDBC driver file is mysql-connector-java-3.1.14-bin
My CLASSPATH variable is set to: C:\Program Files\MySQL\mysql-connector-java-3.1.14
My DB_URL is: jdbc:mysql://localhost/EMP
My package is com.myeclipseide.ws
And I have pasted the class file of the class accessing jdbc driver in the path: C:\Users\Mrinal\Workspaces\MyEclipse 10\restdemo\WebRoot\WEB-INF\lib....
please help
Upvotes: 0
Views: 784
Reputation: 7116
I think, the problem is in your forName
method argument. It should be
Class.forName("com.mysql.jdbc.Driver");
Because
java.lang.Class.forName(Class.java:169) at
This line from your Exception trace, says so!
Upvotes: 0
Reputation: 490
You have to provide more details. I suppose, than the problem is in your class path because in exception text you have:
java.lang.ClassNotFoundException: mysql-connector-java-3.1.14-bin
And there is definitely no such class with name mysql-connector-java-3.1.14-bin. The driver class name for mysql connector is com.mysql.jdbc.Driver.
Upvotes: 2