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

Tomcat and MySQL JDBC Pooling

 
Lakshman Easwaran
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it necessary to have mysql driver jar file in $TOMCAT_HOME/common/lib?

When I have mysql driver jar file in WEB-INF/lib, it fails with error "Unable to load driver class".

When I have other jar files like jstl.jar WEB-INF/lib, system picks it up.

Why is it not picking up MySQL driver jar from WEB-INF/lib?

I have my context xml config file in $TOMCAT_HOME/conf/Catalina/localhost.

I would appreciate if someone could clear my doubts.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that part of the JDBC security model includes where the driver can be loaded from, or more correctly which ClassLoader it gets loaded from. To be honest I'm a little confused since I've seen places where this was an issue and others where it was not.

I have had a second thought, and if you're using the container to manage the database resources (such as using Connect Pooling), you'll need to make the Driver more public than the context level.
 
Satish SN
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lakshman

I think one of the issues would be the mysql.jar file version bcoz if we are using type 4 driver .

bcoz there two different mysql.jar or available in the net one will start with org.gjt.mm.mysql or com.mysql.xxx so u check the jar u are using and also check the connection string what is the package ur using to connect to mysql that should solve ur problem i too faced the same problem earlier...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic