Index: org/postgresql/jdbc2/AbstractJdbc2Connection.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java,v retrieving revision 1.52 diff -c -r1.52 AbstractJdbc2Connection.java *** org/postgresql/jdbc2/AbstractJdbc2Connection.java 1 Jul 2009 05:00:40 -0000 1.52 --- org/postgresql/jdbc2/AbstractJdbc2Connection.java 20 Oct 2009 21:41:35 -0000 *************** *** 684,691 **** */ public void commit() throws SQLException { if (autoCommit) ! return ; if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE) executeTransactionCommand(commitQuery); --- 684,696 ---- */ public void commit() throws SQLException { + if (isClosed()) + throw new PSQLException(GT.tr("Cannot commit when connection is closed."), + PSQLState.CONNECTION_FAILURE); + if (autoCommit) ! throw new PSQLException(GT.tr("Cannot commit when autoCommit is enabled."), ! PSQLState.NO_ACTIVE_SQL_TRANSACTION); if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE) executeTransactionCommand(commitQuery); *************** *** 701,708 **** */ public void rollback() throws SQLException { if (autoCommit) ! return ; if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE) executeTransactionCommand(rollbackQuery); --- 706,718 ---- */ public void rollback() throws SQLException { + if (isClosed()) + throw new PSQLException(GT.tr("Cannot rollback when connection is closed."), + PSQLState.CONNECTION_FAILURE); + if (autoCommit) ! throw new PSQLException(GT.tr("Cannot rollback when autoCommit is enabled."), ! PSQLState.NO_ACTIVE_SQL_TRANSACTION); if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE) executeTransactionCommand(rollbackQuery);