You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "David W. Van Couvering" <Da...@Sun.COM> on 2006/02/03 23:53:47 UTC

Auto-close of result sets on failure?

There is a new metadata call, "autoCommitFailureClosesAllResultSets", 
which returns true if a SQLException while autoCommit is true indicates 
that all open ResultSets are closed, even ones that are holdable.

In my naive scan of the code on the embedded side, it appears as though 
we do *not* close result sets upon exception.  There is a method 
clearResultSets() on EmbedStatement that is only called when the 
statement itself is closed or when executing a new statement (we close 
the old result sets from the previous invocation of the statement).

Because of the asynchronous nature of the network client protocol, it's 
a little harder to decode, but it appears that we do not close result 
sets upon exception there either.

Does anyone care to differ?  Otherwise I'll return false for this new 
JDBC4 metadata call.

Thanks,

David

Re: Auto-close of result sets on failure?

Posted by "David W. Van Couvering" <Da...@Sun.COM>.
Thanks, Dan, I'll run a test.

David

Daniel John Debrunner wrote:
> David W. Van Couvering wrote:
> 
> 
>>There is a new metadata call, "autoCommitFailureClosesAllResultSets",
>>which returns true if a SQLException while autoCommit is true indicates
>>that all open ResultSets are closed, even ones that are holdable.
>>
>>In my naive scan of the code on the embedded side, it appears as though
>>we do *not* close result sets upon exception.  There is a method
>>clearResultSets() on EmbedStatement that is only called when the
>>statement itself is closed or when executing a new statement (we close
>>the old result sets from the previous invocation of the statement).
>>
>>Because of the asynchronous nature of the network client protocol, it's
>>a little harder to decode, but it appears that we do not close result
>>sets upon exception there either.
>>
>>Does anyone care to differ?  Otherwise I'll return false for this new
>>JDBC4 metadata call.
> 
> 
> I think I'll differ. :-)
> 
> In embedded I would think that all the ResultSets would be closed on an
> exception that causes a rollback in auto-commit mode. You may not see
> explict code, but the internal Derby objects the JDBC ResultSet depends
> on will be closed. At least I think it's that way, no idea for client.
> Seems like a simple test is in order.
> 
> Dan.
> 

Re: Auto-close of result sets on failure?

Posted by Daniel John Debrunner <dj...@apache.org>.
David W. Van Couvering wrote:

> There is a new metadata call, "autoCommitFailureClosesAllResultSets",
> which returns true if a SQLException while autoCommit is true indicates
> that all open ResultSets are closed, even ones that are holdable.
> 
> In my naive scan of the code on the embedded side, it appears as though
> we do *not* close result sets upon exception.  There is a method
> clearResultSets() on EmbedStatement that is only called when the
> statement itself is closed or when executing a new statement (we close
> the old result sets from the previous invocation of the statement).
> 
> Because of the asynchronous nature of the network client protocol, it's
> a little harder to decode, but it appears that we do not close result
> sets upon exception there either.
> 
> Does anyone care to differ?  Otherwise I'll return false for this new
> JDBC4 metadata call.

I think I'll differ. :-)

In embedded I would think that all the ResultSets would be closed on an
exception that causes a rollback in auto-commit mode. You may not see
explict code, but the internal Derby objects the JDBC ResultSet depends
on will be closed. At least I think it's that way, no idea for client.
Seems like a simple test is in order.

Dan.