PDA

Click to See Complete Forum and Search --> : Help with MySQL Connector/J


The Hobo
Oct 27th, 2006, 06:17 PM
Has anyone ever used the MySQL Connector/J to interact with a MySQL database?

I'm having trouble getting it to work at all. I've downloaded it, and attempted to put it in multiple locations. I've set my path variable, I've put it in the directory with the source, I've even tried using CLASSPATH to point to it...but no matter what I do, I get this error:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

It manages to compile without any errors or warnings...just won't run.

Has anyone accomplished this before that can walk me through it or provided some suggestions?

I've been over the readme file and various internet sites trying to get it to work with no avail.

CornedBee
Oct 27th, 2006, 08:30 PM
I've even tried using CLASSPATH to point to it...
"Even"? That's the only valid solution, you know.

I've used Connector/J many times and usually without serious problems.

Show us exactly what your Java command line is, where the Connector/J jar resides, what the value of your CLASSPATH variable is.

The reason it compiles is that there is no direct reference to any Connector/J class in the code, just the indirect reference in
Class.forName("com.mysql.jdbc.Driver");
where the compiler doesn't recognize the class name as something that needs to be looked up.