Examples of MysqlXADataSource


Examples of com.mysql.jdbc.jdbc2.optional.MysqlXADataSource

        Class.forName("org.jboss.resource.adapter.jdbc.ValidConnectionChecker");
      } catch (Exception ex) {
        return; // class not available for testing
      }
     
      MysqlXADataSource xaDs = new MysqlXADataSource();
      xaDs.setUrl(dbUrl);
     
      MysqlValidConnectionChecker checker = new MysqlValidConnectionChecker();
      assertNull(checker.isValidConnection(xaDs.getXAConnection().getConnection()));
   
  }
View Full Code Here

Examples of com.mysql.jdbc.jdbc2.optional.MysqlXADataSource

   *
   * @throws Exception if the test fails.
   */
  public void testXADataSource() throws Exception {
 
    MysqlXADataSource ds = new MysqlXADataSource();
    ds.setUrl(dbUrl);
   
    String name = "XA";
    this.ctx.rebind(name, ds);

    Object result = this.ctx.lookup(name);
View Full Code Here

Examples of com.mysql.jdbc.jdbc2.optional.MysqlXADataSource

    MysqlXADataSource xaDs;
   
  public XATest(String name) {
    super(name);
   
    this.xaDs = new MysqlXADataSource();
    this.xaDs.setUrl(BaseTestCase.dbUrl);
    this.xaDs.setRollbackOnPooledClose(true);
  }
View Full Code Here

Examples of com.mysql.jdbc.jdbc2.optional.MysqlXADataSource

      return;
    }
   
    Connection conn1 = null;

    MysqlXADataSource suspXaDs = new MysqlXADataSource();
    suspXaDs.setUrl(BaseTestCase.dbUrl);
    suspXaDs.setPinGlobalTxToPhysicalConnection(true);
    suspXaDs.setRollbackOnPooledClose(true);
   
    XAConnection xaConn1 = null;
   
    Xid xid = createXid();
   
    try {
      /*
          -- works using RESUME
        xa start 0x123,0x456;
        select * from foo;
        xa end 0x123,0x456;
        xa start 0x123,0x456 resume;
        select * from foo;
        xa end 0x123,0x456;
        xa commit 0x123,0x456 one phase;
       */
     
      xaConn1 = suspXaDs.getXAConnection();
      XAResource xaRes1 = xaConn1.getXAResource();
      conn1 = xaConn1.getConnection();
      xaRes1.start(xid, XAResource.TMNOFLAGS);
      conn1.createStatement().executeQuery("SELECT 1");
      xaRes1.end(xid, XAResource.TMSUCCESS);
      xaRes1.start(xid, XAResource.TMRESUME);
      conn1.createStatement().executeQuery("SELECT 1");
      xaRes1.end(xid, XAResource.TMSUCCESS);
      xaRes1.commit(xid, true);
     
      xaConn1.close();
     
      /*

        -- fails using JOIN
        xa start 0x123,0x456;
        select * from foo;
        xa end 0x123,0x456;
        xa start 0x123,0x456 join;
        select * from foo;
        xa end 0x123,0x456;
        xa commit 0x123,0x456 one phase;
        */
   
      xaConn1 = suspXaDs.getXAConnection();
      xaRes1 = xaConn1.getXAResource();
      conn1 = xaConn1.getConnection();
      xaRes1.start(xid, XAResource.TMNOFLAGS);
      conn1.createStatement().executeQuery("SELECT 1");
      xaRes1.end(xid, XAResource.TMSUCCESS);
View Full Code Here

Examples of com.mysql.jdbc.jdbc2.optional.MysqlXADataSource

    }

  }
 
  public void testBug46925() throws Exception {
    MysqlXADataSource xads1 = new MysqlXADataSource();
    MysqlXADataSource xads2 = new MysqlXADataSource();

    Xid txid = new MysqlXid(new byte[] {0x1}, new byte[] {0xf}, 3306);
   
    xads1.setPinGlobalTxToPhysicalConnection(true);
    xads1.setUrl(dbUrl);
   
    xads2.setPinGlobalTxToPhysicalConnection(true);
    xads2.setUrl(dbUrl);
   
    XAConnection c1 = xads1.getXAConnection();
    assertTrue(c1 instanceof SuspendableXAConnection);
    // start a transaction on one connection
    c1.getXAResource().start(txid, XAResource.TMNOFLAGS);
    c1.getXAResource().end(txid, XAResource.TMSUCCESS);
   
    XAConnection c2 = xads2.getXAConnection();
    assertTrue(c2 instanceof SuspendableXAConnection);
    // prepare on another one. Since we are using a "pinned" connection
    // we should have the same "currentXAConnection" for both SuspendableXAConnection
    c2.getXAResource().prepare(txid); // this will fail without the fix.
    c2.getXAResource().commit(txid,false);
View Full Code Here

Examples of com.mysql.jdbc.jdbc2.optional.MysqlXADataSource

        return new XAMetaMessageSessionFactory(initMetaConfig());
    }


    private static XADataSource getXADataSource() throws SQLException {
        final MysqlXADataSource mysqlXADataSource = new MysqlXADataSource();
        mysqlXADataSource
        .setUrl("jdbc:mysql://localhost:3306/test?characterEncoding=utf8&connectTimeout=1000&autoReconnect=true");
        mysqlXADataSource.setUser("root");
        mysqlXADataSource.setPassword("");
        mysqlXADataSource.setPreparedStatementCacheSize(20);
        return mysqlXADataSource;
    }
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.