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

The following are Jave code examples for showing how to use cancel() of the java.sql.PreparedStatement 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: spanner-jdbc   File: CloudSpannerPooledConnectionTest.java   Source Code and License Vote up 6 votes
@Test
public void testPrepareStatement() throws SQLException
{
	CloudSpannerPooledConnection subject = createConnection();
	Connection connection = subject.getConnection();
	PreparedStatement statement = connection.prepareStatement("SELECT COL1, COL2, COL3 FROM FOO");
	assertFalse(statement.isClosed());

	Connection statementConnection = statement.getConnection();
	assertEquals(connection, statementConnection);

	assertEquals(ResultSet.TYPE_FORWARD_ONLY, statement.getResultSetType());
	try
	{
		statement.cancel();
	}
	catch (SQLException e)
	{
	}

	statement.close();
	assertTrue(statement.isClosed());
}