public void rollback() throws SQLException { rollback(true); }
public void recycleConnection() { this.payload = null; try { //close all open statements this.closeStatements(); } catch (SQLException e) { logger.log(Level.WARNING, JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e); //$NON-NLS-1$ } try { //rollback if still in a transaction if (!this.getAutoCommit()) { logger.warning(JDBCPlugin.Util.getString("MMXAConnection.rolling_back")); //$NON-NLS-1$ if (this.getTransactionXid() == null) { this.rollback(false); } else { this.rollbackTransaction(getTransactionXid()); } } } catch (SQLException e) { logger.log(Level.WARNING, JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e); //$NON-NLS-1$ } }
public void rollback() throws SQLException { rollback(true); }
public void recycleConnection() { this.payload = null; try { //close all open statements this.closeStatements(); } catch (SQLException e) { logger.log(Level.WARNING, JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e); //$NON-NLS-1$ } try { //rollback if still in a transaction if (!this.getAutoCommit()) { logger.warning(JDBCPlugin.Util.getString("MMXAConnection.rolling_back")); //$NON-NLS-1$ if (this.getTransactionXid() == null) { this.rollback(false); } else { this.rollbackTransaction(getTransactionXid()); } } } catch (SQLException e) { logger.log(Level.WARNING, JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e); //$NON-NLS-1$ } }
@Override public void rollback(String txnId) throws SQLException { getConnection().rollback(); getConnection().setAutoCommit(true); } }
@Override public void terminate() { remotes.remove(this.secretKey); closePortals(); this.preparedMap.clear(); try { if (this.connection != null) { if (!this.connection.getAutoCommit()) { this.connection.rollback(false); } this.connection.close(); } } catch (SQLException e) { //ignore } this.client.terminated(); }
connection.rollback(false);
@Test public void testTransactionStatements() throws Exception { ConnectionImpl conn = Mockito.mock(ConnectionImpl.class); Properties p = new Properties(); Mockito.stub(conn.getExecutionProperties()).toReturn(p); StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); assertFalse(statement.execute("start transaction")); //$NON-NLS-1$ Mockito.verify(conn).setAutoCommit(false); assertFalse(statement.execute("commit")); //$NON-NLS-1$ Mockito.verify(conn).setAutoCommit(true); assertFalse(statement.execute("start transaction")); //$NON-NLS-1$ assertFalse(statement.execute("rollback")); //$NON-NLS-1$ Mockito.verify(conn).rollback(false); assertFalse(statement.execute("abort transaction")); //$NON-NLS-1$ Mockito.verify(conn, Mockito.times(2)).rollback(false); assertFalse(statement.execute("rollback work")); //$NON-NLS-1$ Mockito.verify(conn, Mockito.times(3)).rollback(false); assertFalse(statement.execute("start transaction isolation level repeatable read")); //$NON-NLS-1$ Mockito.verify(conn).setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); }
commit = false; if (synch || !this.getConnection().isInLocalTxn()) { this.getConnection().rollback(false);
commit = false; if (synch || !this.getConnection().isInLocalTxn()) { this.getConnection().rollback(false);