Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassNotFoundException with mysql

 
mike nu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me figure out what cause this problem:
I am trying to use mysql database and use JDBC to connect to it. But I always get the ClassNotFoundException with the following statement: Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Anyone know the reason? BTW, I am testing this connection in JBuilder 6.0 environment.
Thanks a lot.
 
Amol Desai
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
you need to put the jar file(mysql.jat) of your
driver classes in the classpath of jbuilder 6
You can the jar file in <jbuider-home>/lib/ext directory and restart it.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...and if you're running a Servlet, then the Servlet container will need the MySQL driver JAR as well.
Note that you're using an old driver. You might want to update your code and available classes to make use of com.mysql.jdbc.Driver, available in the newest J/Connector download at mysql.com
 
Rosie Vogel
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dirk Schreckmann:
...and if you're running a Servlet, then the Servlet container will need the MySQL driver JAR as well.

I am having the same problem... I have put the a copy of the MySQL driver JAR in the Tomcat lib directory but that didn't work. Is this what you meant? I also have the jar in my classpath.
 
Victor Pendleton
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rosie, try putting the file in the web-inf/classes directory of your application.
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

where i can download download My Sql driver?

Thanks,
Mats.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49770
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mathews P Srampikal:
hi all,

where i can download download My Sql driver?

Thanks,
Mats.
Please don't come in on somebody else's thread with an unrelated question; that is called hijacking and can divert attention from the original topic.

You should have gone to Google and you would have found this and this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic