Package java.sql

Examples of java.sql.Connection.releaseSavepoint()


     * same name. and release the first one
     */
    public void testReleaseReleasedSavepoint() throws SQLException {
        Connection con = getConnection();
        Savepoint savepoint1 = con.setSavepoint("s1");
        con.releaseSavepoint(savepoint1);
        // The following savepoint was earlier named s1. Changed it to s2 while
        // working on DRDA support
        // for savepoints. The reason for that is as follows
        // The client translates all savepoint jdbc calls to equivalent sql and
        // hence
View Full Code Here


        // savepoint named s1.
        con.setSavepoint("s2");
        Statement s = createStatement();
        s.executeUpdate("INSERT INTO T1 VALUES(2,1)");
        try {
            con.releaseSavepoint(savepoint1);
            fail("FAIL 6a - releasing a released savepoint did not raise error");
        } catch (SQLException se) {
            // Expected exception.
            assertSQLState("3B001", se);
        }
View Full Code Here

     * same name. and rollback the first one
     */
    public void testRollbackReleasedSavepoint() throws SQLException {
        Connection con = getConnection();
        Savepoint savepoint1 = con.setSavepoint("s1");
        con.releaseSavepoint(savepoint1);
        // The following savepoint was earlier named s1. Changed it to s2 while
        // working on DRDA support
        // for savepoints. The reason for that is as follows
        // The client translates all savepoint jdbc calls to equivalent sql and
        // hence
View Full Code Here

        Savepoint savepoint1 = con.setSavepoint("s1");
        Statement s = createStatement();
        s.executeUpdate("INSERT INTO T1 VALUES(2,1)");
        Connection con2 = openDefaultConnection();
        try {
            con2.releaseSavepoint(savepoint1);
            fail("FAIL 6c - releasing another transaction's savepoint did "
                    + "not raise error");
        } catch (SQLException se) {
            // Expected exception.
            if (usingEmbedded()) {
View Full Code Here

     * Test 12 releasing a savepoint multiple times - should not work
     */
    public void testReleaseMultipleTimes() throws SQLException {
        Connection con = getConnection();
        Savepoint savepoint1 = con.setSavepoint("MyName");
        con.releaseSavepoint(savepoint1);
        try {
            con.releaseSavepoint(savepoint1);
            fail("FAIL 12 releasing a savepoint multiple times should fail");
        } catch (SQLException se) {
            // Expected exception.
View Full Code Here

    public void testReleaseMultipleTimes() throws SQLException {
        Connection con = getConnection();
        Savepoint savepoint1 = con.setSavepoint("MyName");
        con.releaseSavepoint(savepoint1);
        try {
            con.releaseSavepoint(savepoint1);
            fail("FAIL 12 releasing a savepoint multiple times should fail");
        } catch (SQLException se) {
            // Expected exception.
            assertSQLState("3B001", se);
        }
View Full Code Here

        con.setAutoCommit(true);
        con.setAutoCommit(false);
        Savepoint savepoint2 = con.setSavepoint("MyName1");
        try {// shouldn't be able to use savepoint from earlier tranasaction
            // after setting autocommit on and off
            con.releaseSavepoint(savepoint1);
            fail("FAIL 13 shouldn't be able to use a savepoint from earlier "
                    + "transaction after setting autocommit on and off");
        } catch (SQLException se) {
            // Expected exception.
            assertSQLState("3B001", se);
View Full Code Here

                    + "transaction after setting autocommit on and off");
        } catch (SQLException se) {
            // Expected exception.
            assertSQLState("3B001", se);
        }
        con.releaseSavepoint(savepoint2);
        con.rollback();
    }

    /**
     * Test 14 cause a transaction rollback and that should release the internal
View Full Code Here

            // Expected exception.
            assertSQLState("40XL1", se);
        }
        try {// the transaction rollback above should have removed the
            // savepoint MyName
            con2.releaseSavepoint(savepoint1);
            fail("FAIL 14 A non-user initiated transaction rollback should "
                    + "release the internal savepoint array");
        } catch (SQLException se) {
            // Expected exception.
            assertSQLState("3B001", se);
View Full Code Here

            // Expected exception.
            assertSQLState("3B002", se);
        }
        // rollback the JDBC savepoint. Now since there are no user defined
        // savepoints, we can define SQL savepoint
        con.releaseSavepoint(savepoint1);
        s.executeUpdate("SAVEPOINT s1 ON ROLLBACK RETAIN LOCKS ON "
                + "ROLLBACK RETAIN CURSORS");
        con.rollback();
    }
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.