I found my error. I was setting ds1 twice in the context and not setting ds2 at all.
Thanks for the help Michael -----Original Message----- From: Michael Holly [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 3:00 PM To: Jakarta Commons Users List Subject: RE: [DBCP] How to kill connection pool when app is reloaded. Thanks to Tony for the help. I created a ContextListener and this works... partially. In my application I actually have to access two datasources. In my development env both data sources reside on the same DB but access different schemas via different userids. In my production the data sources are seperate oracle instances. In the ContextIntialized method the two datasources seem to register just fine. but When the ContextListener destroys I am going through and trying to remove the pool for both datasources. Am I correct in believing that since it looks like I configure two different pools as jndi resources in the context.xml that I have two different pools? Or do I have one pool that stores all the different connections? I find that if I execute the code to remove the second data source if (ds2 instanceof org.apache.commons.dbcp.BasicDataSource) { log.info("Found oracle_talisen connection pool " + ds2.toString() ); ((org.apache.commons.dbcp.BasicDataSource) ds2).close(); ds2 = null; } I get a null pointer exception. This I can understand if connections are stored in one pool. To confirm this I added the ds2.toString() in the log. This confirmed that the objects that ds1 and ds2 are located in the same place in memory. However, the head scratcher here is that the connections for the second datasource do not go away even though it appears that I have killed the pool. Any ideas? Thanks Michael -----Original Message----- From: Tony Locke [mailto:[EMAIL PROTECTED] Sent: Saturday, June 28, 2003 8:40 AM To: Jakarta Commons Users List; [EMAIL PROTECTED] Subject: Re: [DBCP] How to kill connection pool when app is reloaded. Hi Michael, I had this problem and I solved it by putting: if (ds instanceof org.apache.commons.dbcp.BasicDataSource) { ((org.apache.commons.dbcp.BasicDataSource) ds).close(); } in the contextDestroyed method of the context listener class of my web app. Cheers, Tony. On Thu, 26 Jun 2003, Michael Holly wrote: > Hi > > I need to kill my connection pool when I reload the application. > > I am using Tomcat 4.1.24, Oracle 8.1.7, Win 2k, Java 1.3.1 > > I have configured my ant script to deploy my application without > restarting Tomcat. > > Server.xml has no application context information in it. > context.xml contains the context for the application > > I was under the false assumption that the > pool was an application resource and would be reset when the application > got reloaded. In testing yesterday I got an Oracle error about too many > processes. I did some digging and found that every time I redeployed > the application the previous connection pool was staying alive. > > Is there a way to kill the pool? I have a startup servlet that handles > initiation of log4j and caching services. I should be able to put the > code to kill the pool in the destroy method of this servlet. > > Thanks > > Michael > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------- Tony Locke [EMAIL PROTECTED] --------------------------------------------------------- --------------------------------------------------------------------- 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]
