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

connection

 
alan kent
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have downloaded and installed the mysql driver.
The class path is all right.
It compiles with success but when it runs, it doesn't recognise the following driver
Class.forName("org.gjt.mm.mysql.Driver");
the message is java.lang.ClassNotFoundException:
org.gjt.mm.mysql.Driver
Does anybody know where is the error?
 
Michael Zalewski
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a classpath error most likely.
Your compile environment has one classpath that includes the MySQL driver. Your servlet environment does not have the same classpath.
If your servlet environment is 2.2 or higher (or if you are using a .war file), just drop the jar file for the database into your WEB-INF/lib directory and see if that helps.
Another hint: Lots of newbies forget to call DriverManager.registerDriver. You need to do that if you are not using a DataSource
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic