• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic