Reputation: 613
I keep getting
Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at ttest.Sql.readFile(Sql.java:28)
at ttest.Sql.main(Sql.java:68)
to
Class.forName("com.mysql.jdbc.Driver");
on NetBeans and can't see why!
MySQL is running fine with JPA.
Do i need additional settings for JDBC?
burnt so much of my time!!
TIA
Upvotes: 1
Views: 5343
Reputation: 21
Copy mysql-connector-java-5.1.34-bin.jar (it is in the C:\Program Files\MySQL\Connector.J 5.1) into C:\Program Files\Java\jdk1.7.0\jre\lib\ext
Upvotes: 1
Reputation: 994
MySQL connector is already present in Netbeans, you just have to import that into your project. Follow the given STeps
Thats it. Now try running your project.
Upvotes: 0
Reputation: 5868
You would need MYSQL connector
in your class path to connect to MySql database from JDBC
.
You ca get one from here.
Upvotes: 2