Java Code Examples for org.springframework.jdbc.UncategorizedSQLException

The following examples show how to use org.springframework.jdbc.UncategorizedSQLException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Pre-checks the arguments, calls {@link #doTranslate}, and invokes the
 * {@link #getFallbackTranslator() fallback translator} if necessary.
 */
@Override
@NonNull
public DataAccessException translate(String task, @Nullable String sql, SQLException ex) {
	Assert.notNull(ex, "Cannot translate a null SQLException");

	DataAccessException dae = doTranslate(task, sql, ex);
	if (dae != null) {
		// Specific exception match found.
		return dae;
	}

	// Looking for a fallback...
	SQLExceptionTranslator fallback = getFallbackTranslator();
	if (fallback != null) {
		dae = fallback.translate(task, sql, ex);
		if (dae != null) {
			// Fallback exception match found.
			return dae;
		}
	}

	// We couldn't identify it more precisely.
	return new UncategorizedSQLException(task, sql, ex);
}
 
Example 2
Source Project: spring-analysis-note   Source File: JdbcTemplateTests.java    License: MIT License 6 votes vote down vote up
@Test
public void testBogusUpdate() throws Exception {
	final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?";
	final int idParam = 6666;

	// It's because Integers aren't canonical
	SQLException sqlException = new SQLException("bad update");
	given(this.preparedStatement.executeUpdate()).willThrow(sqlException);

	Dispatcher d = new Dispatcher(idParam, sql);
	assertThatExceptionOfType(UncategorizedSQLException.class).isThrownBy(() ->
			this.template.update(d))
		.withCause(sqlException);
	verify(this.preparedStatement).setInt(1, idParam);
	verify(this.preparedStatement).close();
	verify(this.connection, atLeastOnce()).close();
}
 
Example 3
Source Project: spring-analysis-note   Source File: JdbcTemplateTests.java    License: MIT License 6 votes vote down vote up
@Test
public void testBatchUpdateWithBatchFailure() throws Exception {
	final String[] sql = {"A", "B", "C", "D"};
	given(this.statement.executeBatch()).willThrow(
			new BatchUpdateException(new int[] {1, Statement.EXECUTE_FAILED, 1, Statement.EXECUTE_FAILED}));
	mockDatabaseMetaData(true);
	given(this.connection.createStatement()).willReturn(this.statement);

	JdbcTemplate template = new JdbcTemplate(this.dataSource, false);
	try {
		template.batchUpdate(sql);
	}
	catch (UncategorizedSQLException ex) {
		assertThat(ex.getSql(), equalTo("B; D"));
	}
}
 
Example 4
/**
 * Pre-checks the arguments, calls {@link #doTranslate}, and invokes the
 * {@link #getFallbackTranslator() fallback translator} if necessary.
 */
@Override
@NonNull
public DataAccessException translate(String task, @Nullable String sql, SQLException ex) {
	Assert.notNull(ex, "Cannot translate a null SQLException");

	DataAccessException dae = doTranslate(task, sql, ex);
	if (dae != null) {
		// Specific exception match found.
		return dae;
	}

	// Looking for a fallback...
	SQLExceptionTranslator fallback = getFallbackTranslator();
	if (fallback != null) {
		dae = fallback.translate(task, sql, ex);
		if (dae != null) {
			// Fallback exception match found.
			return dae;
		}
	}

	// We couldn't identify it more precisely.
	return new UncategorizedSQLException(task, sql, ex);
}
 
Example 5
Source Project: java-technology-stack   Source File: JdbcTemplateTests.java    License: MIT License 6 votes vote down vote up
@Test
public void testBogusUpdate() throws Exception {
	final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?";
	final int idParam = 6666;

	// It's because Integers aren't canonical
	SQLException sqlException = new SQLException("bad update");
	given(this.preparedStatement.executeUpdate()).willThrow(sqlException);

	Dispatcher d = new Dispatcher(idParam, sql);
	this.thrown.expect(UncategorizedSQLException.class);
	this.thrown.expect(exceptionCause(equalTo(sqlException)));
	try {
		this.template.update(d);
	}
	finally {
		verify(this.preparedStatement).setInt(1, idParam);
		verify(this.preparedStatement).close();
		verify(this.connection, atLeastOnce()).close();
	}
}
 
Example 6
Source Project: java-technology-stack   Source File: JdbcTemplateTests.java    License: MIT License 6 votes vote down vote up
@Test
public void testBatchUpdateWithBatchFailure() throws Exception {
	final String[] sql = {"A", "B", "C", "D"};
	given(this.statement.executeBatch()).willThrow(
			new BatchUpdateException(new int[] {1, Statement.EXECUTE_FAILED, 1, Statement.EXECUTE_FAILED}));
	mockDatabaseMetaData(true);
	given(this.connection.createStatement()).willReturn(this.statement);

	JdbcTemplate template = new JdbcTemplate(this.dataSource, false);
	try {
		template.batchUpdate(sql);
	}
	catch (UncategorizedSQLException ex) {
		assertThat(ex.getSql(), equalTo("B; D"));
	}
}
 
Example 7
/**
 * Pre-checks the arguments, calls {@link #doTranslate}, and invokes the
 * {@link #getFallbackTranslator() fallback translator} if necessary.
 */
@Override
public DataAccessException translate(String task, String sql, SQLException ex) {
	Assert.notNull(ex, "Cannot translate a null SQLException");
	if (task == null) {
		task = "";
	}
	if (sql == null) {
		sql = "";
	}

	DataAccessException dex = doTranslate(task, sql, ex);
	if (dex != null) {
		// Specific exception match found.
		return dex;
	}
	// Looking for a fallback...
	SQLExceptionTranslator fallback = getFallbackTranslator();
	if (fallback != null) {
		return fallback.translate(task, sql, ex);
	}
	// We couldn't identify it more precisely.
	return new UncategorizedSQLException(task, sql, ex);
}
 
Example 8
Source Project: spring4-understanding   Source File: JdbcTemplateTests.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testBogusUpdate() throws Exception {
	final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?";
	final int idParam = 6666;

	// It's because Integers aren't canonical
	SQLException sqlException = new SQLException("bad update");
	given(this.preparedStatement.executeUpdate()).willThrow(sqlException);

	Dispatcher d = new Dispatcher(idParam, sql);
	this.thrown.expect(UncategorizedSQLException.class);
	this.thrown.expect(exceptionCause(equalTo(sqlException)));
	try {
		this.template.update(d);
	}
	finally {
		verify(this.preparedStatement).setInt(1, idParam);
		verify(this.preparedStatement).close();
		verify(this.connection, atLeastOnce()).close();
	}
}
 
Example 9
Source Project: spring4-understanding   Source File: JdbcTemplateTests.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testBatchUpdateWithBatchFailure() throws Exception {
	final String[] sql = {"A", "B", "C", "D"};
	given(this.statement.executeBatch()).willThrow(
			new BatchUpdateException(new int[] { 1, Statement.EXECUTE_FAILED, 1,
				Statement.EXECUTE_FAILED }));
	mockDatabaseMetaData(true);
	given(this.connection.createStatement()).willReturn(this.statement);

	JdbcTemplate template = new JdbcTemplate(this.dataSource, false);
	try {
		template.batchUpdate(sql);
	}
	catch (UncategorizedSQLException ex) {
		assertThat(ex.getSql(), equalTo("B; D"));
	}
}
 
Example 10
@Override
public String testSqlGrammar( String sql )
{
    String viewName = SqlView.PREFIX_VIEWNAME + System.currentTimeMillis();

    sql = "CREATE VIEW " + viewName + " AS " + sql;

    log.debug( "Test view SQL: " + sql );

    try
    {
        jdbcTemplate.execute( sql );

        jdbcTemplate.execute( "DROP VIEW IF EXISTS " + viewName );
    }
    catch ( BadSqlGrammarException | UncategorizedSQLException ex )
    {
        return ex.getCause().getMessage();
    }

    return null;
}
 
Example 11
/**
 * Pre-checks the arguments, calls {@link #doTranslate}, and invokes the
 * {@link #getFallbackTranslator() fallback translator} if necessary.
 */
@Override
public DataAccessException translate(String task, String sql, SQLException ex) {
	Assert.notNull(ex, "Cannot translate a null SQLException");
	if (task == null) {
		task = "";
	}
	if (sql == null) {
		sql = "";
	}

	DataAccessException dex = doTranslate(task, sql, ex);
	if (dex != null) {
		// Specific exception match found.
		return dex;
	}
	// Looking for a fallback...
	SQLExceptionTranslator fallback = getFallbackTranslator();
	if (fallback != null) {
		return fallback.translate(task, sql, ex);
	}
	// We couldn't identify it more precisely.
	return new UncategorizedSQLException(task, sql, ex);
}
 
Example 12
Source Project: effectivejava   Source File: JdbcTemplateTests.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testBogusUpdate() throws Exception {
	final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?";
	final int idParam = 6666;

	// It's because Integers aren't canonical
	SQLException sqlException = new SQLException("bad update");
	given(this.preparedStatement.executeUpdate()).willThrow(sqlException);

	Dispatcher d = new Dispatcher(idParam, sql);
	this.thrown.expect(UncategorizedSQLException.class);
	this.thrown.expect(exceptionCause(equalTo(sqlException)));
	try {
		this.template.update(d);
	}
	finally {
		verify(this.preparedStatement).setInt(1, idParam);
		verify(this.preparedStatement).close();
		verify(this.connection, atLeastOnce()).close();
	}
}
 
Example 13
Source Project: effectivejava   Source File: JdbcTemplateTests.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testBatchUpdateWithBatchFailure() throws Exception {
	final String[] sql = {"A", "B", "C", "D"};
	given(this.statement.executeBatch()).willThrow(
			new BatchUpdateException(new int[] { 1, Statement.EXECUTE_FAILED, 1,
				Statement.EXECUTE_FAILED }));
	mockDatabaseMetaData(true);
	given(this.connection.createStatement()).willReturn(this.statement);

	JdbcTemplate template = new JdbcTemplate(this.dataSource, false);
	try {
		template.batchUpdate(sql);
	}
	catch (UncategorizedSQLException ex) {
		assertThat(ex.getSql(), equalTo("B; D"));
	}
}
 
Example 14
@Test
public void testTransactionAwareDataSourceProxy() throws Exception {
	given(con.getAutoCommit()).willReturn(true);

	TransactionTemplate tt = new TransactionTemplate(tm);
	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
	tt.execute(new TransactionCallbackWithoutResult() {
		@Override
		protected void doInTransactionWithoutResult(TransactionStatus status) {
			// something transactional
			assertEquals(con, DataSourceUtils.getConnection(ds));
			TransactionAwareDataSourceProxy dsProxy = new TransactionAwareDataSourceProxy(ds);
			try {
				assertEquals(con, ((ConnectionProxy) dsProxy.getConnection()).getTargetConnection());
				// should be ignored
				dsProxy.getConnection().close();
			}
			catch (SQLException ex) {
				throw new UncategorizedSQLException("", "", ex);
			}
		}
	});

	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
	InOrder ordered = inOrder(con);
	ordered.verify(con).setAutoCommit(false);
	ordered.verify(con).commit();
	ordered.verify(con).setAutoCommit(true);
	verify(con).close();
}
 
Example 15
@Test
public void invalidSqlStateCode() {
	SQLException sex = new SQLException("Message", "NO SUCH CODE", 1);
	try {
		throw this.trans.translate("task", sql, sex);
	}
	catch (UncategorizedSQLException ex) {
		// OK
		assertTrue("SQL is correct", sql.equals(ex.getSql()));
		assertTrue("Exception matches", sex.equals(ex.getSQLException()));
	}
}
 
Example 16
private void testMalformedSqlStateCode(SQLException sex) {
	try {
		throw this.trans.translate("task", sql, sex);
	}
	catch (UncategorizedSQLException ex) {
		// OK
		assertTrue("SQL is correct", sql.equals(ex.getSql()));
		assertTrue("Exception matches", sex.equals(ex.getSQLException()));
	}
}
 
Example 17
@Test
public void testTransactionAwareDataSourceProxy() throws Exception {
	given(con.getAutoCommit()).willReturn(true);

	TransactionTemplate tt = new TransactionTemplate(tm);
	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
	tt.execute(new TransactionCallbackWithoutResult() {
		@Override
		protected void doInTransactionWithoutResult(TransactionStatus status) {
			// something transactional
			assertEquals(con, DataSourceUtils.getConnection(ds));
			TransactionAwareDataSourceProxy dsProxy = new TransactionAwareDataSourceProxy(ds);
			try {
				assertEquals(con, ((ConnectionProxy) dsProxy.getConnection()).getTargetConnection());
				// should be ignored
				dsProxy.getConnection().close();
			}
			catch (SQLException ex) {
				throw new UncategorizedSQLException("", "", ex);
			}
		}
	});

	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
	InOrder ordered = inOrder(con);
	ordered.verify(con).setAutoCommit(false);
	ordered.verify(con).commit();
	ordered.verify(con).setAutoCommit(true);
	verify(con).close();
}
 
Example 18
@Test
public void invalidSqlStateCode() {
	SQLException sex = new SQLException("Message", "NO SUCH CODE", 1);
	try {
		throw this.trans.translate("task", sql, sex);
	}
	catch (UncategorizedSQLException ex) {
		// OK
		assertTrue("SQL is correct", sql.equals(ex.getSql()));
		assertTrue("Exception matches", sex.equals(ex.getSQLException()));
	}
}
 
Example 19
private void testMalformedSqlStateCode(SQLException sex) {
	try {
		throw this.trans.translate("task", sql, sex);
	}
	catch (UncategorizedSQLException ex) {
		// OK
		assertTrue("SQL is correct", sql.equals(ex.getSql()));
		assertTrue("Exception matches", sex.equals(ex.getSQLException()));
	}
}
 
Example 20
/**
 * Pre-checks the arguments, calls {@link #doTranslate}, and invokes the
 * {@link #getFallbackTranslator() fallback translator} if necessary.
 */
@Override
public DataAccessException translate(String task, String sql, SQLException ex) {
	Assert.notNull(ex, "Cannot translate a null SQLException");
	if (task == null) {
		task = "";
	}
	if (sql == null) {
		sql = "";
	}

	DataAccessException dae = doTranslate(task, sql, ex);
	if (dae != null) {
		// Specific exception match found.
		return dae;
	}

	// Looking for a fallback...
	SQLExceptionTranslator fallback = getFallbackTranslator();
	if (fallback != null) {
		dae = fallback.translate(task, sql, ex);
		if (dae != null) {
			// Fallback exception match found.
			return dae;
		}
	}

	// We couldn't identify it more precisely.
	return new UncategorizedSQLException(task, sql, ex);
}
 
Example 21
@Test
public void testTransactionAwareDataSourceProxy() throws Exception {
	given(con.getAutoCommit()).willReturn(true);

	TransactionTemplate tt = new TransactionTemplate(tm);
	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
	tt.execute(new TransactionCallbackWithoutResult() {
		@Override
		protected void doInTransactionWithoutResult(TransactionStatus status) {
			// something transactional
			assertEquals(con, DataSourceUtils.getConnection(ds));
			TransactionAwareDataSourceProxy dsProxy = new TransactionAwareDataSourceProxy(ds);
			try {
				assertEquals(con, ((ConnectionProxy) dsProxy.getConnection()).getTargetConnection());
				assertEquals(con, new SimpleNativeJdbcExtractor().getNativeConnection(dsProxy.getConnection()));
				// should be ignored
				dsProxy.getConnection().close();
			}
			catch (SQLException ex) {
				throw new UncategorizedSQLException("", "", ex);
			}
		}
	});

	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
	InOrder ordered = inOrder(con);
	ordered.verify(con).setAutoCommit(false);
	ordered.verify(con).commit();
	ordered.verify(con).setAutoCommit(true);
	verify(con).close();
}
 
Example 22
@Test
public void invalidSqlStateCode() {
	SQLException sex = new SQLException("Message", "NO SUCH CODE", 1);
	try {
		throw this.trans.translate("task", sql, sex);
	}
	catch (UncategorizedSQLException ex) {
		// OK
		assertTrue("SQL is correct", sql.equals(ex.getSql()));
		assertTrue("Exception matches", sex.equals(ex.getSQLException()));
	}
}
 
Example 23
private void testMalformedSqlStateCode(SQLException sex) {
	try {
		throw this.trans.translate("task", sql, sex);
	}
	catch (UncategorizedSQLException ex) {
		// OK
		assertTrue("SQL is correct", sql.equals(ex.getSql()));
		assertTrue("Exception matches", sex.equals(ex.getSQLException()));
	}
}
 
Example 24
@Test
public void testTransactionAwareDataSourceProxy() throws Exception {
	given(con.getAutoCommit()).willReturn(true);

	TransactionTemplate tt = new TransactionTemplate(tm);
	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
	tt.execute(new TransactionCallbackWithoutResult() {
		@Override
		protected void doInTransactionWithoutResult(TransactionStatus status) {
			// something transactional
			assertEquals(con, DataSourceUtils.getConnection(ds));
			TransactionAwareDataSourceProxy dsProxy = new TransactionAwareDataSourceProxy(ds);
			try {
				assertEquals(con, ((ConnectionProxy) dsProxy.getConnection()).getTargetConnection());
				assertEquals(con, new SimpleNativeJdbcExtractor().getNativeConnection(dsProxy.getConnection()));
				// should be ignored
				dsProxy.getConnection().close();
			}
			catch (SQLException ex) {
				throw new UncategorizedSQLException("", "", ex);
			}
		}
	});

	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
	InOrder ordered = inOrder(con);
	ordered.verify(con).setAutoCommit(false);
	ordered.verify(con).commit();
	ordered.verify(con).setAutoCommit(true);
	verify(con).close();
}
 
Example 25
public void testInvalidSqlStateCode() {
	String sql = "SELECT FOO FROM BAR";
	SQLException sex = new SQLException("Message", "NO SUCH CODE", 1);
	try {
		throw this.trans.translate("task", sql, sex);
	}
	catch (UncategorizedSQLException ex) {
		// OK
		assertTrue("SQL is correct", sql.equals(ex.getSql()));
		assertTrue("Exception matches", sex.equals(ex.getSQLException()));
	}
}
 
Example 26
private void testMalformedSqlStateCode(SQLException sex) {
	String sql = "SELECT FOO FROM BAR";
	try {
		throw this.trans.translate("task", sql, sex);
	}
	catch (UncategorizedSQLException ex) {
		// OK
		assertTrue("SQL is correct", sql.equals(ex.getSql()));
		assertTrue("Exception matches", sex.equals(ex.getSQLException()));
	}
}
 
Example 27
/**
 * for Spring 4.x
 */
protected DataAccessException translateException(String task, String sql, SQLException ex) {
    DataAccessException dae = getExceptionTranslator().translate(task, sql, ex);
    return (dae != null ? dae : new UncategorizedSQLException(task, sql, ex));
}
 
Example 28
private void doTestTransactionCommitRestoringAutoCommit(
		boolean autoCommit, boolean lazyConnection, final boolean createStatement) throws Exception {

	if (lazyConnection) {
		given(con.getAutoCommit()).willReturn(autoCommit);
		given(con.getTransactionIsolation()).willReturn(Connection.TRANSACTION_READ_COMMITTED);
	}

	if (!lazyConnection || createStatement) {
		given(con.getAutoCommit()).willReturn(autoCommit);
	}

	final DataSource dsToUse = (lazyConnection ? new LazyConnectionDataSourceProxy(ds) : ds);
	tm = new DataSourceTransactionManager(dsToUse);
	TransactionTemplate tt = new TransactionTemplate(tm);
	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(dsToUse));
	assertTrue("Synchronization not active", !TransactionSynchronizationManager.isSynchronizationActive());

	tt.execute(new TransactionCallbackWithoutResult() {
		@Override
		protected void doInTransactionWithoutResult(TransactionStatus status) throws RuntimeException {
			assertTrue("Has thread connection", TransactionSynchronizationManager.hasResource(dsToUse));
			assertTrue("Synchronization active", TransactionSynchronizationManager.isSynchronizationActive());
			assertTrue("Is new transaction", status.isNewTransaction());
			assertFalse(TransactionSynchronizationManager.isCurrentTransactionReadOnly());
			assertTrue(TransactionSynchronizationManager.isActualTransactionActive());
			Connection tCon = DataSourceUtils.getConnection(dsToUse);
			try {
				if (createStatement) {
					tCon.createStatement();
				}
			}
			catch (SQLException ex) {
				throw new UncategorizedSQLException("", "", ex);
			}
		}
	});

	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(dsToUse));
	assertTrue("Synchronization not active", !TransactionSynchronizationManager.isSynchronizationActive());

	if (autoCommit && (!lazyConnection || createStatement)) {
		InOrder ordered = inOrder(con);
		ordered.verify(con).setAutoCommit(false);
		ordered.verify(con).commit();
		ordered.verify(con).setAutoCommit(true);
	}
	if (createStatement) {
		verify(con, times(2)).close();
	}
	else {
		verify(con).close();
	}
}
 
Example 29
@Test
public void testTranslateUncategorized() throws Exception {
	doTest("00000000", UncategorizedSQLException.class);
}
 
Example 30
private void doTestTransactionCommitRestoringAutoCommit(
		boolean autoCommit, boolean lazyConnection, final boolean createStatement) throws Exception {

	if (lazyConnection) {
		given(con.getAutoCommit()).willReturn(autoCommit);
		given(con.getTransactionIsolation()).willReturn(Connection.TRANSACTION_READ_COMMITTED);
	}

	if (!lazyConnection || createStatement) {
		given(con.getAutoCommit()).willReturn(autoCommit);
	}

	final DataSource dsToUse = (lazyConnection ? new LazyConnectionDataSourceProxy(ds) : ds);
	tm = new DataSourceTransactionManager(dsToUse);
	TransactionTemplate tt = new TransactionTemplate(tm);
	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(dsToUse));
	assertTrue("Synchronization not active", !TransactionSynchronizationManager.isSynchronizationActive());

	tt.execute(new TransactionCallbackWithoutResult() {
		@Override
		protected void doInTransactionWithoutResult(TransactionStatus status) throws RuntimeException {
			assertTrue("Has thread connection", TransactionSynchronizationManager.hasResource(dsToUse));
			assertTrue("Synchronization active", TransactionSynchronizationManager.isSynchronizationActive());
			assertTrue("Is new transaction", status.isNewTransaction());
			assertFalse(TransactionSynchronizationManager.isCurrentTransactionReadOnly());
			assertTrue(TransactionSynchronizationManager.isActualTransactionActive());
			Connection tCon = DataSourceUtils.getConnection(dsToUse);
			try {
				if (createStatement) {
					tCon.createStatement();
				}
			}
			catch (SQLException ex) {
				throw new UncategorizedSQLException("", "", ex);
			}
		}
	});

	assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(dsToUse));
	assertTrue("Synchronization not active", !TransactionSynchronizationManager.isSynchronizationActive());

	if (autoCommit && (!lazyConnection || createStatement)) {
		InOrder ordered = inOrder(con);
		ordered.verify(con).setAutoCommit(false);
		ordered.verify(con).commit();
		ordered.verify(con).setAutoCommit(true);
	}
	if (createStatement) {
		verify(con, times(2)).close();
	}
	else {
		verify(con).close();
	}
}