Java Code Examples for java.sql.Statement.cancel()

The following are Jave code examples for showing how to use cancel() of the java.sql.Statement class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: the-vigilantes   File: StatementRegressionTest.java   Source Code and License Vote up 6 votes
/**
 * Tests fix for BUG#20650 - Statement.cancel() causes NullPointerException
 * if underlying connection has been closed due to server failure.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug20650() throws Exception {
    Connection closedConn = null;
    Statement cancelStmt = null;

    try {
        closedConn = getConnectionWithProps((String) null);
        cancelStmt = closedConn.createStatement();

        closedConn.close();

        cancelStmt.cancel();
    } finally {
        if (cancelStmt != null) {
            cancelStmt.close();
        }

        if (closedConn != null && !closedConn.isClosed()) {
            closedConn.close();
        }
    }
}
 
Example 2
Project: OpenVertretung   File: StatementRegressionTest.java   Source Code and License Vote up 6 votes
/**
 * Tests fix for BUG#20650 - Statement.cancel() causes NullPointerException
 * if underlying connection has been closed due to server failure.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug20650() throws Exception {
    Connection closedConn = null;
    Statement cancelStmt = null;

    try {
        closedConn = getConnectionWithProps((String) null);
        cancelStmt = closedConn.createStatement();

        closedConn.close();

        cancelStmt.cancel();
    } finally {
        if (cancelStmt != null) {
            cancelStmt.close();
        }

        if (closedConn != null && !closedConn.isClosed()) {
            closedConn.close();
        }
    }
}
 
Example 3
Project: ProyectoPacientes   File: StatementRegressionTest.java   Source Code and License Vote up 6 votes
/**
 * Tests fix for BUG#20650 - Statement.cancel() causes NullPointerException
 * if underlying connection has been closed due to server failure.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug20650() throws Exception {
    Connection closedConn = null;
    Statement cancelStmt = null;

    try {
        closedConn = getConnectionWithProps((String) null);
        cancelStmt = closedConn.createStatement();

        closedConn.close();

        cancelStmt.cancel();
    } finally {
        if (cancelStmt != null) {
            cancelStmt.close();
        }

        if (closedConn != null && !closedConn.isClosed()) {
            closedConn.close();
        }
    }
}
 
Example 4
Project: BibliotecaPS   File: StatementRegressionTest.java   Source Code and License Vote up 6 votes
/**
 * Tests fix for BUG#20650 - Statement.cancel() causes NullPointerException
 * if underlying connection has been closed due to server failure.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug20650() throws Exception {
    Connection closedConn = null;
    Statement cancelStmt = null;

    try {
        closedConn = getConnectionWithProps((String) null);
        cancelStmt = closedConn.createStatement();

        closedConn.close();

        cancelStmt.cancel();
    } finally {
        if (cancelStmt != null) {
            cancelStmt.close();
        }

        if (closedConn != null && !closedConn.isClosed()) {
            closedConn.close();
        }
    }
}