tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Flavio Reis <>
Subject Re: refresh bad db connection on tomcat - urgent help
Date Tue, 04 Nov 2008 22:34:26 GMT

Hi Srinivas,

Have you already solved this problem?
I have the same, an i can`t get the solution.


Christopher Schultz-2 wrote:
> Hash: SHA1
> Srinivas,
> Srinivas Jonnalagadda wrote:
>> what is the syntaxt to refresh bad db connection on tomcat -
>> context.xml? We are using tomcata 5.5.9 connecting to oracle 10. The
>> issue is that our jvm crashed because in the connection pool we had
>> bad db connection and it the connections were out of limit. we could
>> not detect and it happened in our prod environment. if there is any
>> command for that it would be great help.
> Just to be clear: you ran out of database connections, or your database
> connections went stale and you just need to replace one connection at a
> time?
> If you are getting stale connections, you just need to set a "validation
> query" in your connection configuration. In your application's
> META-INF/context.xml, you should have a <Resource> element which defines
> your data source (this may also be in Tomcat's server.xml if you have a
> global data source). Just add
> validationQuery="SELECT 1 FROM DUAL"
> to detect stale connections. The query itself is irrelevant, except that
> it needs to return successfully and you want something that's not going
> to put a load on the server. Some drivers/servers support a 'ping' query
> that is super lightweight (for instance, recent versions of MySQL's
> Connector/J allows a query starting with '/* ping */' to be used as a
> lightweight communications check).
> If you are leaking connections from your pool, you should review your
> application for proper try/finally processing of JDBC connections.
> Tomcat's connection pool (which is really commons-dbcpo in disguise) can
> help you find places where connection are being leaked using a few other
> attributes:
>         logAbandoned="true"
>         removeAbandoned="true"
>         removeAbandonedTimeout="30"
> These settings tell the connection pool that it should keep track of
> where connections are borrowed from the connection pool. If the
> connection hasn't been returned to the pool within
> "removeAbandonedTimeout" seconds, then the connection will be purged
> from the pool, and a stack trace showing the code that borrowed the
> connection will be dumped into your log.
> See for more
> information.
> Hope that helps,
> - -chris
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla -
> RfYAnjnaW8aSH4ZGOJqrg4GAXshyasyk
> =FsRS
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Tomcat - User mailing list archive at

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message