what i did is: in the $CATALINA_HOME/conf/server.xml added the <Resource> inside a <DefaultContext> ('cause i want it available to all webapps) in the $CATALINA_HOME/commons/lib i put the jdbc driver and dbcp's jar (it must be available to tomcat when starting up the default context) in the WEB-INF/web.xml i declare the resources requirements for each webapp
it works r ----- Original Message ----- From: "Erik Price" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Wednesday, January 29, 2003 4:54 PM Subject: DBCP usage w/servlets > I found a promising-looking post in the archives about using DBCP in a > Tomcat-based servlet environment: > > http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg67843.html > > Unfortunately, the link to the source code (the "meat" of the post) is > broken. Does anyone have any sample source code or other references > suggesting how to go about adding DBCP into a webapp? I have installed > the DBCP JAR library into my webapp's WEB-INF/lib, and the MySQL driver > JAR is in $CATALINA_HOME/common/lib, so I'm raring to go. > > (I've read the instructions in the DBCP API and I think I get the idea. > It's not using DBCP's classes that I'm unsure of /per se/, rather it's > how to go about setting up DBCP in the context of a servlet container. > My first idea was to write a simple servlet that sets up the connection > pool in its init() method. Then I thought that seems a little > inelegant, and perhaps a ContextListener would do (it would listen for > the startup of my webapp and then initialize the connection pool when > the webapp starts). But I'm not sure if this is the right solution either.) > > How do YOU implement DBCP? > > Thanks, > > Erik > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]