Re: connection timeout limit?
- From: "joeNOSPAM@xxxxxxx" <joe.weinstein@xxxxxxxxx>
- Date: 21 Feb 2007 07:26:46 -0800
On Feb 20, 9:27 pm, "Dishan" <dis...@xxxxxxxxx> wrote:
Hi All,
What is the best method the close the dead database connection(oracle)
while connection time is too long.?
I have a database connection pool and having some probleam (hang)
while closing expired database connection in my web site(using
tomcat5).
Is there anyway to set connection timeout period for the connection
that will automatically close the connection in my souce code?
void expire( Connection connection )
{
try
{
logger.info( "closing JDBC connection...");
connection.close(); // *** hanging here
logger.info( "JDBC connection closed successfully!");
}
catch( SQLException e )
{
e.printStackTrace();
}
}
Thanks in advance.
-Dish
Hi. No, there's no way to define ahead of time that a connection will
self-close at any particular time. Are you absolutely sure that no
other thread is using this connection?
I suspect that you have a firewall between the DBMS and driver.
If that is true, the firewall may kill sockets that haven't been
used for some time, and after that anything the driver sends on
that socket will be ignored, but from the driver's and OS's point
of view, the socket isn't dead so your close (or any other call)
may hang for a long time or indefinitely. Your best solution is
to either keep your connections busy enough that the firewall
never kills them, (even artificially with an occasional 'select 1
from dual'), or you must be sure to close your idle connections
before they are closed by the firewall.
Joe Weinstein at BEA Systems
.
- Follow-Ups:
- Re: connection timeout limit?
- From: Dishan
- Re: connection timeout limit?
- References:
- connection timeout limit?
- From: Dishan
- connection timeout limit?
- Prev by Date: Re: connection timeout limit?
- Next by Date: Looking for Feedback on New Project - ChaiDB and JSON-Cache
- Previous by thread: Re: connection timeout limit?
- Next by thread: Re: connection timeout limit?
- Index(es):
Relevant Pages
|
|