Package javax.sql

Examples of javax.sql.XAConnection.addConnectionEventListener()


        aes2.resetState();

        // test "local" XAConnections
        xac = dsx.getXAConnection();
        AssertEventCatcher aes4 = new AssertEventCatcher(4);
        xac.addConnectionEventListener(aes4);
        assertConnectionOK(
            expectedValues, "XADataSource", xac.getConnection());
        //Check if got connection closed event but not connection error event
        assertTrue(aes4.didConnectionClosedEventHappen());
        assertFalse(aes4.didConnectionErrorEventHappen());
View Full Code Here


        xac.close();

        // test "global" XAConnections
        xac = dsx.getXAConnection();
        AssertEventCatcher aes5 = new AssertEventCatcher(5);
        xac.addConnectionEventListener(aes5);
        XAResource xar = xac.getXAResource();
        // checks currently only implemented for embedded
        if (usingEmbedded())
        {
           SecurityCheck.assertSourceSecurity(
View Full Code Here

        // handled correctly
        // Some more isolation testing using SQL and JDBC api
        XADataSource dsx = J2EEDataSource.getXADataSource();
        XAConnection xac = dsx.getXAConnection();
        AssertEventCatcher aes6 = new AssertEventCatcher(6);
        xac.addConnectionEventListener(aes6);
        XAResource xar = xac.getXAResource();
        Connection conn = xac.getConnection();
        Statement s = conn.createStatement();
        // initial local
        assertConnectionState(
View Full Code Here

            ResultSet.HOLD_CURSORS_OVER_COMMIT};

        XADataSource dsx = J2EEDataSource.getXADataSource();
        XAConnection xac = dsx.getXAConnection();
        AssertEventCatcher aes6 = new AssertEventCatcher(6);
        xac.addConnectionEventListener(aes6);
        XAResource xar = xac.getXAResource();
        Xid xid = new cdsXid(1, (byte) 103, (byte) 119);

        // now check re-use of *Statement objects across local/global
        // connections.
View Full Code Here

        aes6.resetState();

        // attach the XA transaction to another connection and see what happens
        XAConnection xac2 = dsx.getXAConnection();
        AssertEventCatcher aes5 = new AssertEventCatcher(5);
        xac2.addConnectionEventListener(aes5);
        XAResource xar2 = xac2.getXAResource();

        xar2.start(xid, XAResource.TMJOIN);
        Connection cs2 = xac2.getConnection();
View Full Code Here

        aes5.resetState();
        xac2.close();

        // allow close on already closed XAConnection
        xac2.close();
        xac2.addConnectionEventListener(null);
        xac2.removeConnectionEventListener(null);

        // test methods against a closed XAConnection and its resource
        try {
            // (DERBY-2532)
View Full Code Here

  public GenerationObject create(String _user, String _password)
    throws SQLException {
    GenerationObject genObject;
    XAConnection xaCon = xads.getXAConnection(_user, _password);
    // get the xa connection
    xaCon.addConnectionEventListener(this); // add it to the event listener
    log.debug(
      "StandardXAPoolDataSource:create create a object for the pool");
    genObject =
      new GenerationObject(xaCon, pool.getGeneration(), _user, _password);
View Full Code Here

    if (testConnectionToString)
      checkToString(dsx);

    XAConnection xac = dsx.getXAConnection();
    SecurityCheck.inspect(xac, "javax.sql.XAConnection");
    xac.addConnectionEventListener(new EventCatcher(3));

    checkConnection("XADataSource", xac.getConnection());

    // BUG 4471 - check outstanding updates are rolled back wi XAConnection.
    c1 = xac.getConnection();
View Full Code Here

    checkConnection("ConnectionPoolDataSource", pc.getConnection());
    checkConnection("ConnectionPoolDataSource", pc.getConnection());

    // test "local" XAConnections
    xac = dsx.getXAConnection();
    xac.addConnectionEventListener(new EventCatcher(4));
    checkConnection("XADataSource", xac.getConnection());
    checkConnection("XADataSource", xac.getConnection());
    xac.close();

    // test "global" XAConnections
View Full Code Here

    checkConnection("XADataSource", xac.getConnection());
    xac.close();

    // test "global" XAConnections
    xac = dsx.getXAConnection();
    xac.addConnectionEventListener(new EventCatcher(5));
    XAResource xar = xac.getXAResource();
    SecurityCheck.inspect(xar, "javax.transaction.xa.XAResource");
    Xid xid = new cdsXid(1, (byte) 35, (byte) 47);
    xar.start(xid, XAResource.TMNOFLAGS);
    Connection xacc = xac.getConnection();
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.