This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection pooling question: Can MySQL Conector/J be in WEB-INF/lib?

 
Bojan Tomic
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to know if it is possible to use connection pooling in Tomcat without having the JDBC driver (MySQL Connector/J in my case) inside commons/lib directory, but inside your WEB-INF/lib instead?
I have tried doing this, of course, and it doesn't seem to work, but I can't be sure if it is a problem with my configuration. With the driver present in commons/lib, it works as normal.
I searched around quite a bit, but I keep running into conflicting information. Is there a chance of conflict if I put the JDBC driver in both commons/lib and WEB-INF lib?
For the reference I am using Tomcat 6.0.16 and Connector/J 5.1.6. My context.xml is as follows:

Any thoughts on this?

[ October 13, 2008: Message edited by: Veggen Skrikk ]
[ October 13, 2008: Message edited by: Veggen Skrikk ]
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Veggen Skrikk:
I need to know if it is possible to use connection pooling in Tomcat without having the JDBC driver (MySQL Connector/J in my case) inside commons/lib directory, but inside your WEB-INF/lib instead?


I would say no. If you want the container to manage your connections, the JDBC driver has to be in the container's classpath, not the application's.
 
Bhaskar Rao
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Even if you do have the MySQL driver at the web app level at WEB-INF/lib Tomcat will use the driver located at TOMCAT_HOME/common/lib. The driver located at WEB-INF/lib will not be 'visible' to Tomcat classes.

I dont see any conflict if you do have the driver at both locations, but what is the need for the driver to be available at the web app level?
 
Bojan Tomic
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok people, thanks a lot for clearing it up for me! I'm grateful.
Oh, and I asked if driver being present on both location would cause a conflict only because I accidentaly shipped an application with a copy of the driver in WEB-INF/lib and I was afraid it might cause troubles.

Thanks again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic