java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Posted by: arif
Date: May 09, 2005 09:26PM

i'm a newbie to jdbc and was trying out a basic program to connect to the database.
I have followed the instructuon to copy the mysql-connector-java-3.1.6-bin.jar to C:\Program Files\Java\jdk1.5.0\jre\lib\ext

this is my program :

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class mysqlloaddriver {

private static String URL = "jdbc:odbc:Skynet";
private static Connection conn = null;

public static void main(String[] args) {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost/test", "root", "password");
}
catch (ClassNotFoundException CNFE) {
CNFE.printStackTrace();
}
catch (SQLException SQLE) {
SQLE.printStackTrace();
}
catch (Exception E) {
E.printStackTrace();
}
}
}

and when compiled, i got this :

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
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 mysqlloaddriver.main(mysqlloaddriver.java:12)

please help..., thank you.....

Options: ReplyQuote


Subject
Written By
Posted
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
May 09, 2005 09:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.