Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with JDBC driver for MySQL

 
dorjee gyaltsen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I started writing my JDBC program, I have a problem while connecting to MySQL server using the following code

Class.forName("com.mysql.jdbc.Driver");

It throws an CLASSNOTFOUNDEXCEPTION

Can anyone list the possible ways to fix the error??


Many thanks in advance
 
Dharamvir (DV) Punia
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Few things to look at:
1. your driver jar file might not be in your classpath.
2. If you do have the driver jar file in your path, then you might be using the wrong name check for spelling mistakes.
3. If you don't have the driver, try to find one for the required db.

I hope this helps.
-DV
 
Al Tam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is usually a classpath problem. It is likely that the jdbc drivers is NOT in your classpath.

Are you trying to access the DB through a DataSource / connection pool / EJB container?

If you are, you'll need to read the doc's on how to add the drivers to the classpath of the tool that you are using.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic