This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "connection" Watch "connection" New topic


alan kent

Joined: Jan 25, 2003
Posts: 19
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
the message is java.lang.ClassNotFoundException:
Does anybody know where is the error?
Michael Zalewski
Ranch Hand

Joined: Apr 23, 2002
Posts: 168
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
I agree. Here's the link:
subject: connection
Similar Threads
How to connect MySQL DB from JSP?
registering the database driver
MySQL Driver not found in Tomcat Question.
MySQL Beginner Has Problem With Loading JDBC Driver
HibernateException Pls Help