Re: JDBC driver doesn't close socket event after connection.close()

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Alin Sinpalean (alin_at_earthling.net)
Date: 02/19/05


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.



Relevant Pages

  • Re: Memory leak with createStatement?
    ... I written by own Database Connection Pooling object, ... > now closing them in a finalize method. ... When you return the connection to the pool, you should close all JDBC objects because ...
    (comp.lang.java.programmer)
  • Re: Why Would ResponseStream().Read return zero bytes when not at end of file?
    ... there is no network requirement that the number of bytes delivered by the server before closing the connection is identical to the number of bytes the server advertised in the HTTP response. ... The advertised length is just that: an advertisement. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Closing connections
    ... I am getting connection pool timeouts and am only testing the site so I'm not sure why. ... Dim strSQL As String ... and it looks like you left everything open without closing them before you left. ... You read the data with a datareader that is reading the data from the resultset at the spot of the returned resultset, you instantiate a DTO, you add the DTO ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Problem mit "Mail"
    ... Escape character is '^]'. ... 250 HELP ... Connection closed by foreign host. ... 221 mxintern.kundenserver.de closing connection ...
    (de.comp.sys.mac.internet)
  • Re: Closing DataReader using ApplicationBlocks
    ... you need be concerned about closing the connection when you close the dr. ... Dim dr as SqlDataReader ... Joe Fallon "Paolo Pignatelli" wrote in message ...
    (microsoft.public.dotnet.framework.aspnet)