aspose file tools
The moose likes JDBC and the fly likes Driver not found Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Driver not found" Watch "Driver not found" New topic
Author

Driver not found

Sasikanth Malladi
Ranch Hand

Joined: Nov 04, 2000
Posts: 175
All, I'm trying to integrate JDBC into my servlet.

I have a working JDBC example which simply runs a select and prints the results.

I also have a simple servlet which says hello.
So far so good.

However when I put the JDBC driver in the servlet init() method, I'm getting the exception java.lang.ClassNotFoundException: com.mysql.jdbc.Driver.

This is what is throwing the exception:


The compilation is working ok. Only when I upload my servlet class to the (tomcat) webserver, I'm getting a runtime exception.

I'm using Eclipse for development and am sure that the mySQL driver is in the build path.
Looks like the driver is present in the compile path but not runtime path. I have verified CLASSPATH and it does point to the driver jar file.

Suggestions?

Thanks,
Sashi
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2343

Tomcat does not use your classpath variable.
Put the driver jar in the:
tomcat5: /common/lib/ folder
tomcat6: /lib

Restart tomcat.

Regards, Jan


OCUP UML fundamental
ITIL foundation
Sasikanth Malladi
Ranch Hand

Joined: Nov 04, 2000
Posts: 175
Worked like a charm!
Thanks, Jan.
Sashi
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Driver not found
 
Similar Threads
Getting Connected
Teradata Datasource configuration on WAS V5
need help on dynamic loading of jdbc driver
JDBC drivers/getting JDBC started
Connection to MySQL