Re: JDBC driver doesn't close socket event after connection.close()
From: Alin Sinpalean (alin_at_earthling.net)
Date: 02/19/05
- Next message: Alin Sinpalean: "Re: Long running open connections badly leak memory"
- Previous message: Joe Weinstein: "Re: JDBC driver doesn't close socket event after connection.close()"
- In reply to: Hamelech Al Hakol: "Re: JDBC driver doesn't close socket event after connection.close()"
- Messages sorted by: [ date ] [ thread ]
Date: 19 Feb 2005 10:32:44 -0800
Hamelech Al Hakol wrote:
> I thought that according to JDBC specs, the closing of a connection
also
> closes all statements associated with that connection. Is this not
so?
Yes, but there is one catch. Closing a connection obtained from a pool
doesn't really close it, it merely returns it to the pool. I imagined
that since your app was running continuously it could have been using a
connection pool.
And unless the pool is really smart (such as DBCP) to completely wrap
the connection objects and make sure to close all statements if the
user forgets to do that, you'll end up with _a lot_ of statements. This
might not be your case, but it's a very possible scenario. This is just
one of the reasons why explicitly closing _all_ JDBC resources
(connections, statements and result sets) is always a good idea.
Alin.
- Next message: Alin Sinpalean: "Re: Long running open connections badly leak memory"
- Previous message: Joe Weinstein: "Re: JDBC driver doesn't close socket event after connection.close()"
- In reply to: Hamelech Al Hakol: "Re: JDBC driver doesn't close socket event after connection.close()"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|