commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DBCP-413) Closing a Connection does not close Statement objects created on that connection, by way of the close() method.
Date Thu, 10 Apr 2014 01:40:15 GMT

    [ https://issues.apache.org/jira/browse/DBCP-413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13964885#comment-13964885
] 

Phil Steitz commented on DBCP-413:
----------------------------------

Do you have statement pooling configured?  In general, once you close a connection, your client
code should discard references to and not attempt further operations on the connection or
any statements or resultsets created using it.  DBCP does try to comply with the spec above
so in fact the statements should be getting closed on connection close.  Can you provide more
info on exactly what your client code is doing?

> Closing a Connection does not close Statement objects created on that connection, by
way of the close() method.
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: DBCP-413
>                 URL: https://issues.apache.org/jira/browse/DBCP-413
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Mark W
>            Priority: Minor
>
> While using the MS SQL 2012 jdbc drivers with dbcp, I noticed that if you create a connection,
then create a preparedStatement from that connection, and close the connection object, PreparedStatement.isClosed()
will return false, but you will get a SQLException stating the statement has been closed if
you attempt to call any of the set or execute methods.
> From the JDBC spec:
> Connection.close
> An application calls the method Connection.close() to indicate that it has finished using
a connection. All Statement objects created from a given Connection object will be closed
when the close method for the Connection object is called.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message