Package javax.transaction.xa

Examples of javax.transaction.xa.XAResource.start()


            XAResource xar = xac.getXAResource();

            Xid xid11 = XATestUtil.getXid(11, 3, 128);

            try {
                xar.start(xid11, XAResource.TMJOIN);
            } catch (XAException e) {
                if (e.errorCode != XAException.XAER_NOTA)
                    throw e;
            }
View Full Code Here


                if (e.errorCode != XAException.XAER_NOTA)
                    throw e;
            }

            try {
                xar.start(xid11, XAResource.TMRESUME);
            } catch (XAException e) {
                if (e.errorCode != XAException.XAER_NOTA)
                    throw e;
            }
View Full Code Here

             select * from global_xactTable where gxid is not null order by gxid,username;
             insert into foo values (3);
             */

            Xid xid = XATestUtil.getXid(1001, 66, 13);
            xar.start(xid, XAResource.TMNOFLAGS);
            XATestUtil.showXATransactionView(conn);
            s.executeUpdate("insert into APP.foo values (2003)");

            /*
             -- disallowed
View Full Code Here

            /*
             -- dup id
             xa_start xa_noflags 1;
             */
            try {
                xar.start(xid, XAResource.TMNOFLAGS);
                System.out.println("FAIL - start with duplicate XID");
            } catch (XAException e) {
                if (e.errorCode != XAException.XAER_DUPID)
                    throw e;
            }
View Full Code Here

             select * from global_xactTable where gxid is not null order by gxid,username;
             xa_end xa_suspend 2;
             */

            Xid xid2 = XATestUtil.getXid(1002, 23, 3);
            xar.start(xid2, XAResource.TMNOFLAGS);
            try {
                conn.commit();
                System.out.println("FAIL: commit allowed in global xact");
            } catch (SQLException e) {
            }
View Full Code Here

             -- now morph it to a global transaction
             xa_start xa_noflags 3;
             */
            Xid xid3 = XATestUtil.getXid(1003, 27, 9);
            try {
                xar.start(xid3, XAResource.TMNOFLAGS);
                System.out.println("FAIL XAResource.start on a global transaction with an active local transaction (autocommit false)");
            } catch (XAException xae) {
                if (xae.errorCode != XAException.XAER_OUTSIDE)
                    throw xae;
                System.out.println("Correct XAException on starting a global transaction with an active local transaction (autocommit false)");
View Full Code Here

                if (xae.errorCode != XAException.XAER_OUTSIDE)
                    throw xae;
                System.out.println("Correct XAException on starting a global transaction with an active local transaction (autocommit false)");
            }
            conn.commit();
            xar.start(xid3, XAResource.TMNOFLAGS);

            /*
             -- now I shouldn't be able to yank it
             xa_getconnection;
             */
 
View Full Code Here

            // is in auto-commit mode, thus the start performs
            // an implicit commit to complete the local transaction.
           
            System.out.println("START GLOBAL TRANSACTION");
            // start a global xact and test those statements.
            xar.start(xid, XAResource.TMNOFLAGS);
           
            // Statements not returning ResultSet's should be ok
            sdh.executeUpdate("DELETE FROM APP.FOO where A < -99");
            shh.executeUpdate("DELETE FROM APP.FOO where A < -99");
            sch.executeUpdate("DELETE FROM APP.FOO where A < -99");
View Full Code Here

        public void start(TransactionResource resource) throws DavException {
            XAResource xaRes = getXAResource(resource);
            try {
                xaRes.setTransactionTimeout((int) getLock().getTimeout() / 1000);
                xaRes.start(xid, XAResource.TMNOFLAGS);
            } catch (XAException e) {
                throw new DavException(DavServletResponse.SC_FORBIDDEN, e.getMessage());
            }
        }
View Full Code Here

      Connection conn1 = xac.getConnection();
      System.out.println("By default, autocommit is " + conn1.getAutoCommit() + " for a connection");
      System.out.println("Default holdability for a connection is HOLD_CURSORS_OVER_COMMIT");
      System.out.println("CONNECTION(not in xa transaction yet) HOLDABILITY " + (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
      //start a global transaction and default holdability and autocommit will be switched to match Derby XA restrictions
      xr.start(xid, XAResource.TMNOFLAGS);
      System.out.println("Notice that autocommit now is " + conn1.getAutoCommit() + " for connection because it is part of the global transaction");
      System.out.println("Notice that connection's holdability at this point is CLOSE_CURSORS_AT_COMMIT because it is part of the global transaction");
      System.out.println("CONNECTION(in xa transaction) HOLDABILITY " + (conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
      xr.end(xid, XAResource.TMSUCCESS);
      conn1.commit();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.