Affects Version/s: 2.2.0
Fix Version/s: 2.8.0
DelegatingConnection caches the input of setReadOnly and setAutoCommit directly without checking if the underlying connection succeeded in setting the configuration parameter. This results in wrong return value from isReadOnly and getAutoCommit if the underlying connection doesn't support read-only/non-read-only or auto-commit/non-auto-commit connections, as with SqlServerConnection.
To reproduce the issue:
- Create a DelegatingConnection with an underlying SqlServerConnection
- Set the connection read-only `con.setReadOnly(true)`
- Query the read-only state on the DelegatingConnection, you will get true
- Query the read-only state of the underlying SqlServerConnection, you will get false (SqlServer JDBC driver doesn't support read-only connections)