Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-558

DelegatingConnection setReadOnly and setAutoCommit sometimes caches the wrong value

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.8.0
    • Labels:
      None

      Description

      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:

      1. Create a DelegatingConnection with an underlying SqlServerConnection
      2. Set the connection read-only `con.setReadOnly(true)`
      3. Query the read-only state on the DelegatingConnection, you will get true
      4. Query the read-only state of the underlying SqlServerConnection, you will get false (SqlServer JDBC driver doesn't support read-only connections)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                louislatreille Louis Latreille
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m