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 Tomcat and the fly likes Driver is not loading 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 » Products » Tomcat
Bookmark "Driver is not loading" Watch "Driver is not loading" New topic
Author

Driver is not loading

Singh Anisha
Ranch Hand

Joined: May 09, 2012
Posts: 100

I code a servlet to establish connection with mysql.
set classpath of mysqldriver(setting environment variable from windows)
by mannually setting the classpath from cmd...
i checked the classpath at cmd it was echoing.
but driver was not loading


When i tried the same thing in NetBeans its working fine.
Can anybody help me out regarding the same.
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1449
    
    6

For web application you need to have the driver (.jar) files inside WEB-INF\lib directory.


Swastik
Singh Anisha
Ranch Hand

Joined: May 09, 2012
Posts: 100

I did that too but of no use
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Singh Anisha wrote:set classpath of mysqldriver(setting environment variable from windows)
by mannually setting the classpath from cmd...
i checked the classpath at cmd it was echoing.

That is all useless. Web applications do not pay any attention whatsoever to the command line class path.

Are you using container-managed connection pooling? If not, you should be. But if not, then placing the jar file in WEB-INF/lib should work. If it's not, your web app is likely not configured correctly. Does it look correct in the Tomcat Manager application?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Driver is not loading
 
Similar Threads
Oracle Drivers under Tomcat 5.5
jdbc, db2, no suitable driver, linux
problen in headfirst mvc tutorial
Caught java.lang.UnsatisfiedLinkError
How to load the db driver from jar file?