Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-1236

Verify that applications can't manipulate the transaction state while inside a distributed transaction.

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1.2.1
    • Fix Version/s: 10.2.1.6
    • Component/s: JDBC
    • Labels:
      None

      Description

      The next rev of the JDBC4 spec will clarify that applications may not call the following methods while inside distributed transactions: setAutoCommit( true ), commit(), rollback(), and setSavepoint(). We should verify that we conform.

      1. derby-1236.v1.diff
        1 kB
        Dyre Tjeldvoll
      2. derby-1236.v1.stat
        0.5 kB
        Dyre Tjeldvoll

        Issue Links

          Activity

          Hide
          dyret Dyre Tjeldvoll added a comment -

          setAutoCommit(), commit() and rollback() inside a global transaction is tested in jdbcapi/XATest.java (and others).

          setSavepoint() and setSavepoint(String) are NOT tested, but I have verfied that they throw an exception in a global transaction.

          The exceptions thrown are (note that the setSavepoint methods uses the same Exception/error message as rollback):

          commit():
          SQL Exception: Cannot commit a global transaction using the Connection, commit p
          rocessing must go thru XAResource interface.

          rollback():
          SQL Exception: Cannot rollback a global transaction using the Connection, commit
          processing must go thru XAResource interface.

          setAutoCommit(true):
          SQL Exception: Cannot set AUTOCOMMIT ON when in an XA connection.

          setSavepoint():
          SQL Exception: Cannot rollback a global transaction using the Connection, commit
          processing must go thru XAResource interface.

          setSavepoint(String):
          SQL Exception: Cannot rollback a global transaction using the Connection, commit
          processing must go thru XAResource interface.

          I plan to add setSavepoint() and setSavepoint(String) as test cases in XATest.java.

          Show
          dyret Dyre Tjeldvoll added a comment - setAutoCommit(), commit() and rollback() inside a global transaction is tested in jdbcapi/XATest.java (and others). setSavepoint() and setSavepoint(String) are NOT tested, but I have verfied that they throw an exception in a global transaction. The exceptions thrown are (note that the setSavepoint methods uses the same Exception/error message as rollback): commit(): SQL Exception: Cannot commit a global transaction using the Connection, commit p rocessing must go thru XAResource interface. rollback(): SQL Exception: Cannot rollback a global transaction using the Connection, commit processing must go thru XAResource interface. setAutoCommit(true): SQL Exception: Cannot set AUTOCOMMIT ON when in an XA connection. setSavepoint(): SQL Exception: Cannot rollback a global transaction using the Connection, commit processing must go thru XAResource interface. setSavepoint(String): SQL Exception: Cannot rollback a global transaction using the Connection, commit processing must go thru XAResource interface. I plan to add setSavepoint() and setSavepoint(String) as test cases in XATest.java.
          Hide
          dyret Dyre Tjeldvoll added a comment -

          Attiching patch (v1) that adds (negative) testcases for setSavePoint() inside a global transaction.
          I have not run derbyall, but I have run XATest.java with java 1.4, 1.5, and 1.6 in embedded and DerbyNetClient. The test appears to be disabled in 1.3 and fails on trunk in DerbyNet.

          Please review

          Show
          dyret Dyre Tjeldvoll added a comment - Attiching patch (v1) that adds (negative) testcases for setSavePoint() inside a global transaction. I have not run derbyall, but I have run XATest.java with java 1.4, 1.5, and 1.6 in embedded and DerbyNetClient. The test appears to be disabled in 1.3 and fails on trunk in DerbyNet. Please review
          Hide
          rhillegas Rick Hillegas added a comment -

          Thanks, Dyre. I'll take a look at this patch.

          Show
          rhillegas Rick Hillegas added a comment - Thanks, Dyre. I'll take a look at this patch.
          Hide
          rhillegas Rick Hillegas added a comment -

          Committed at subversion revision 396889.

          Show
          rhillegas Rick Hillegas added a comment - Committed at subversion revision 396889.

            People

            • Assignee:
              dyret Dyre Tjeldvoll
              Reporter:
              rhillegas Rick Hillegas
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development