db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dag.wan...@oracle.com (Dag H. Wanvik)
Subject Re: Java 7 try-with-resources (AutoClosable) on Derby connections with auto-commit off
Date Fri, 10 Aug 2012 16:29:35 GMT
Rick Hillegas <rick.hillegas@oracle.com> writes:

> Thanks for the code snippet, Kristian. I don't see this as a Derby
> problem. 

Hmm.. IMHO I'd like a close that does what I tell it. In my mind that
means rolling back and closing.

That the current behavior doesn't play well with autoclosable is a (new)
argument for changed behavior.

Dag



> It might make sense for the JDBC spec to point out the
> undefined AutoClosable behavior of Connection:
>
> o Statements and ResultSets have well defined close() semantics and
> can be used portably in try-with-resources blocks.
>
> o But the behavior of Connection.close() is undefined. This makes it
> hard to write portable code which declares Connections in
> try-with-resources blocks.
>
> Thanks,
> -Rick

Mime
View raw message