Has anyone considered the case of using try-with-resources (Java SE
7) with Derby connections with auto-commit off?
I haven't studied this in detail, but from what I can see the above
configuration will cause Connection.close to throw an exception if a
transaction is active. Based on what the Java API docs say, I think
Derby is behaving in a way that's allowed . Nonetheless, this may
not be what users expect.
I suppose one could work around this issue with an extra try-catch
block, where you would call rollback/commit before rethrowing the
exception, but this kind of defeats the purpose of
Connection.close implements AutoClosable.close so we can't have two
different behaviors for the two  scenarios (try-with-resources vs
Have I missed something that makes this problem moot?
 "It is strongly recommended that an application
explicitly commits or rolls back an active transaction prior to
close method. If the
method is called and there is an active transaction, the results are
 Maybe one could use stack trace inspection, but that doesn't
sound like a good solution.