File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Unable to load mysql-jdbc driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Unable to load mysql-jdbc driver" Watch "Unable to load mysql-jdbc driver" New topic
Author

Unable to load mysql-jdbc driver

Mandy Smith
Ranch Hand

Joined: Jun 26, 2001
Posts: 62
Hi,
I am not able to connect to mysql database using mysql-jdbc driver(org.gjt.mm.mysql.Driver). When i run my TestApp, then i get an exception saying
java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver. I am not sure how to solve this problem.
Questions:
1. Do i have to start mysql database in the background for jdbc to work?
2. How do i create username and password in mysql database?
3. I start my mysql database as follows:
I have created a database name as :mytest
open dos prompt
type in mysqld
type connect mytest
That's all i do, i am connected to the database named mytest. Here i can create, select from tables.
4. What should exactly be in my classpath for this driver to be loaded properly.
My Classpath is as follows:
set CLASSPATH=.;C:\jdk1.3\lib\classes.zip
set CLASSPATH=%CLASSPATH%;V:\Personal\MySQLDatabase\jdbcForMysql\org\gjt\mm.mysql
set CLASSPATH=%CLASSPATH%;V:\Personal\src\classes
Could anyone please let me know.
Appreciate u'r help.
Thanks,

Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
I'm running linux so it may be different, but the driver looks the same. The one I downloaded was a .jar file, and I put that jar in my classpath and it worked fine. I don't see the jar directly in your classpath. That might be your problem.
Mandy Smith
Ranch Hand

Joined: Jun 26, 2001
Posts: 62
Thanks, but i downloaded the zip version and unzipped the files. I am not sure exactly what to include in my classpath now.
Any further help?
Thanks,
Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
If I were you I'd jar the files into one archive and then include it in your classpath. Or you can redownload it as a jar file. I got mine from here:
MySQL
They should have what you're looking for. Even though I'm running linux, this should still be relatively applicable.
I have the jar stored in the following directory:
/root
and then the end of my classpath is as follows:
/root/mm.mysql-2.0.2-bin.jar:
Note: ":" is used instead of ";" in linux.
I hope that helps.
-Sean

[This message has been edited by Sean Casey (edited June 28, 2001).]
[This message has been edited by Sean Casey (edited June 28, 2001).]
Mandy Smith
Ranch Hand

Joined: Jun 26, 2001
Posts: 62
Thanks Sean Casey, i just sticked in the jar file you mentioned to my classpath and it worked.
Thanks again!
Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
I'm glad I could be of help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to load mysql-jdbc driver