A Resource for a JDBC Connection.
A Resource for a JDBC Connection.
It is implementation-defined behavior to close a JDBC connection with an open transaction, and at least one database interprets that as "throw an exception if there is a pending transaction". This rolls back any pending transaction before closing the connection. If the rollback throws, the close will still be attempted, and if the close also throws its exception will be added to the rollback exception's suppressed list.
(Since version 2.3.1) Implement a specific instance of Resource for this type