tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <>
Subject Re: How to close all connections in a Tomcat container db connection pool?
Date Mon, 16 May 2011 15:04:14 GMT
in Tomcat 7 (not sure if backported to 6), you configure a




On 5/11/2011 7:55 AM, Christopher Schultz wrote:
> Hash: SHA1
> Dale,
> On 5/10/2011 7:24 PM, Dale Ogilvie wrote:
>> The cause of the error was the db admin patching a db package underlying
>> one used by our web-app. Post patch all the packages appeared valid to
>> the admin, but not to our app using db connections established prior to
>> the db patching.
> Looks like the Oracle connection caches some of that metadata. Maybe
> your dba shouldn't mess with that kind of stuff while the application is
> running :)
>> Is there any way to tell the running Tomcat to clean out the connection
>> pool, so that it throws away all the established connections, and
>> establishes new ones for the applications. I don't really want to have
>> to stop all the applications on our server to deal with this sort of
>> issue.
> You'll have to basically reach-into the JNDI context, pull-out the
> DataSource object, cross your fingers and cast it to some "known" object
> type (like org.apache.tomcat.dbcp.dbcp.BasicDataSource) and then call
> methods on that Tomcat-specific class.
> You could call the "close" method on that class, but I suspect you'll
> end up with an empty, useless pool at that point. It's possible that the
> pool will re-initialize itself when you call getConnection but you'll
> have to check that out for yourself.
> You could also look into using JMX, but you'll have to poke around
> looking for the key for your DataSource and then I don't have any idea
> what actions are available... YMMV.
> Maybe there's a method on the Oracle-specific connection object(s) that
> you can use to flush all the metadata. You might want to look into that,
> too.
> Finally, if you use a webapp-specific DataSource (that is, not a
> "global" one) and you properly close the DataSource when the webapp
> shuts down, a new one should be created for your when the new instance
> of the webapp launches.
> Hope that helps,
> - -chris
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla -
> QsYAnjQTGHKiwGNTrdkBkRkHbwPebosE
> =Z1eH
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> -----
> No virus found in this message.
> Checked by AVG -
> Version: 10.0.1321 / Virus Database: 1500/3629 - Release Date: 05/10/11

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message