• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I get error with driver:may have mysql 5.1 and driver is for 5.0?

 
Leonidas Savvides
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get error with driver:

C:\Users\User\Documents\TextBooksDataFiles\JAVA\xml-java\Examples12\Examples\Example 12-1 2-tier JDBC QUERY Example>javac DatabaseAccess.java

C:\Users\User\Documents\TextBooksDataFiles\JAVA\xml-java\Examples12\Examples\Example 12-1 2-tier JDBC QUERY Example>java DatabaseAccess
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
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 DatabaseAccess.main(DatabaseAccess.java:11)

C:\Users\User\Documents\TextBooksDataFiles\JAVA\xml-java\Examples12\Examples\Example 12-1 2-tier JDBC QUERY Example>

folder contains DatabaseAccess.java and mysql-driver.jar (2004) , may have mysql 5.1 and driver is for 5.0?


success
INSERT INTO claim
VALUES (1,'B2007-11-051','Broken window',150.00,true,'2007-05-11',1);
INSERT INTO claim
VALUES (2,'C2007-04-131','Stained carpet',1000.00,false,'2007-04-13',2);
INSERT INTO claim
VALUES (3,'C2007-22-011','Stolen camera',650.00,true,'2007-01-22',2);
INSERT INTO claim
VALUES (4,'B2007-04-011','House burned down',350000.00,true,'2007-01-04',3);

 
Jan Cumps
Bartender
Posts: 2599
12
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to add that driver to your classpath when running your code. Putting it in that directory does not help (and I would not reccomend you to do that).
 
Leonidas Savvides
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem solved thks!...

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic