• Post Reply Bookmark Topic Watch Topic
  • New Topic

Driver is not loading  RSS feed

 
Singh Anisha
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1812
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For web application you need to have the driver (.jar) files inside WEB-INF\lib directory.
 
Singh Anisha
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did that too but of no use
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!