I have just installed Mysql 5 and MySQL Connector/J 5.0. I try to load driver. Here is my code.
VB Code:
import java.sql.*; public class TestMysql { public static void main(String args[]) throws Exception{ String driver = "com.mysql.jdbc.Driver"; Class.forName( driver ); } }
Then i compiled and run. The following message display.
VB Code:
Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc.Driv er at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at TestMysql.main(TestMysql.java:7)
What does it mean? I am new to Java and Mysql. Please tell me step by step to connect Java with Mysql.




Reply With Quote