Wednesday, November 24, 2010

How to configure Java mysql driver and CLASSPATH?

Hello,



I'm using this code to test out the jdbc mysql driver:

--------------

import java.sql.Connection;

import java.sql.DriverManager;



public class Test {

public static void main(String[] args) {

Class.forName(%26quot;com.mysql.jdbc.Driver%26quot;?br>
}

}



I've put the mysqljdbc.jar in the appropriate folder and set the CLASSPATH as well to .;C:\Program Files\Java\jre6\lib\ext\mysqljdbc.jar;C:?Files\Java\jre6\lib\ext\QTJava.zip



When I compile I get a ClassNotFoundException.



What am I doing wrong??

ThanksHow to configure Java mysql driver and CLASSPATH?
I cannot exactly pinpoint the problem but I think it would be a great help for you if you change your Java Editor/IDE for this matter.



You may want to use Eclipse IDE to build your Java program(s):



http://eclipse.org/



Eclipse have a nice way of including Jar libraries to your classpath. Not only that, it will immediately point out compile time errors upon typing!
  • designing greeting cards
  • make to afford
  •