Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to load mysql-jdbc driver

 
Mandy Smith
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 625
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 625
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sean Casey, i just sticked in the jar file you mentioned to my classpath and it worked.
Thanks again!
 
Sean Casey
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm glad I could be of help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic