HikariCP
HikariCP copied to clipboard
Hikari does not handle SQLFeatureNotSupportedException in PoolBase.setupConnection when setting autoCommit
While fixing issue 1116, calls to connection.getAutoCommit()
and connection.isReadOnly()
were added to gate calls to the associated setters in PoolBase
. However, this breaks integration with the mongo-jdbc-driver as getAutoCommit()
throws a SQLFeatureNotSupportedException
because the driver acts as though autoCommit
is always false.
As per the Connection
documentation, "if setAutoCommit
is called, and the auto-commit mode is not changed, the call is a no-op", so I believe the correct way to handle this would be to remove the gates, but I believe the following would work as well:
try {
if (connection.getAutoCommit() ~= isAutoCommit) {
connection.setAutoCommit(isAutocommit);
}
} catch (SQLFeatureNotSupportedException {
// pass;
}