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

Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 10.0.2.0
    • 10.1.1.0, 10.2.1.6
    • JDBC
    • None

    Description

      Reporting for Mamta Satoor, filed on Derby-dev list.

      I think there is a bug in Derby when the user code tries to get the
      Connection object from XAConnection "inside" the global transaction.
      In this case, the Connection object gets created with un-supported
      holdability. Look at the following piece of code and it's output to
      see what exactly happens
      EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
      dscsx.setDatabaseName("wombat");
      XAConnection xac = dscsx.getXAConnection("fred", "wilma");
      XAResource xr = xac.getXAResource();
      xid = getXid(27, (byte) 21, (byte) 01);
      xr.start(xid, XAResource.TMNOFLAGS);
      conn1 = xac.getConnection();
      System.out.println("This is a bug. Connection's holdability should
      have been CLOSE_CURSORS_AT_COMMIT since it is in the global
      transaction");
      System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
      (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
      System.out.println("Autocommit on Connection inside global
      transaction has been set correctly to " + conn1.getAutoCommit());
      xr.end(xid, XAResource.TMSUCCESS);
      The output for the above piece of code is
      This is a bug. Connection's holdability should have been
      CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
      CONNECTION(in xa transaction) HOLDABILITY true
      Autocommit on Connection inside global transaction has been set
      correctly to false

      Attachments

        1. Derby8_Derby366_061805.txt
          33 kB
          Mamta A. Satoor

        Issue Links

          Activity

            People

              mamtas Mamta A. Satoor
              tulika Tulika Agrawal
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: