/** * Closes the underlying connection, and close * any Statements that were not explicitly closed. */ public void close() throws SQLException { passivate(); _conn.close(); }
/** * Closes the underlying connection, and close * any Statements that were not explicitly closed. */ public void close() throws SQLException { passivate(); _conn.close(); }
/** * Closes the underlying connection, and close * any Statements that were not explicitly closed. */ public void close() throws SQLException { passivate(); _conn.close(); }
public void passivateObject(Object obj) throws Exception { if(obj instanceof Connection) { Connection conn = (Connection)obj; if(!conn.getAutoCommit() && !conn.isReadOnly()) { conn.rollback(); } conn.clearWarnings(); if(!conn.getAutoCommit()) { conn.setAutoCommit(true); } } if(obj instanceof DelegatingConnection) { ((DelegatingConnection)obj).passivate(); } }
public void passivateObject(Object obj) throws Exception { if(obj instanceof Connection) { Connection conn = (Connection)obj; if(!conn.getAutoCommit() && !conn.isReadOnly()) { conn.rollback(); } conn.clearWarnings(); if(!conn.getAutoCommit()) { conn.setAutoCommit(true); } } if(obj instanceof DelegatingConnection) { ((DelegatingConnection)obj).passivate(); } }
public void passivateObject(Object obj) throws Exception { if(obj instanceof Connection) { Connection conn = (Connection)obj; if(!conn.getAutoCommit() && !conn.isReadOnly()) { conn.rollback(); } conn.clearWarnings(); if(!conn.getAutoCommit()) { conn.setAutoCommit(true); } } if(obj instanceof DelegatingConnection) { ((DelegatingConnection)obj).passivate(); } }
/** * Sakai modification: don't set autocommit, don't rollback if so configured! */ public void passivateObject(Object obj) throws Exception { if (obj instanceof Connection) { Connection conn = (Connection) obj; if (m_rollbackOnReturn) { if (!conn.getAutoCommit() && !conn.isReadOnly()) { Exception e = new RuntimeException("Automatic Transaction Rollback"); log.error("Transaction RolledBack!", e); conn.rollback(); } } conn.clearWarnings(); // conn.setAutoCommit(true); } if (obj instanceof DelegatingConnection) { ((DelegatingConnection) obj).passivate(); } }
/** * Sakai modification: don't set autocommit, don't rollback if so configured! */ public void passivateObject(Object obj) throws Exception { if (obj instanceof Connection) { Connection conn = (Connection) obj; if (m_rollbackOnReturn) { if (!conn.getAutoCommit() && !conn.isReadOnly()) { Exception e = new RuntimeException("Automatic Transaction Rollback"); log.error("Transaction RolledBack!", e); conn.rollback(); } } conn.clearWarnings(); // conn.setAutoCommit(true); } if (obj instanceof DelegatingConnection) { ((DelegatingConnection) obj).passivate(); } }
protected void passivate() throws SQLException { try { // The JDBC spec requires that a Connection close any open // Statement's when it is closed. // DBCP-288. Not all the traced objects will be statements List traces = getTrace(); if(traces != null) { Iterator traceIter = traces.iterator(); while (traceIter.hasNext()) { Object trace = traceIter.next(); if (trace instanceof Statement) { ((Statement) trace).close(); } else if (trace instanceof ResultSet) { // DBCP-265: Need to close the result sets that are // generated via DatabaseMetaData ((ResultSet) trace).close(); } } clearTrace(); } setLastUsed(0); if(_conn instanceof DelegatingConnection) { ((DelegatingConnection)_conn).passivate(); } } finally { _closed = true; } }
protected void passivate() throws SQLException { try { // The JDBC spec requires that a Connection close any open // Statement's when it is closed. List statements = getTrace(); if( statements != null) { Statement[] set = new Statement[statements.size()]; statements.toArray(set); for (int i = 0; i < set.length; i++) { set[i].close(); } clearTrace(); } setLastUsed(0); if(_conn instanceof DelegatingConnection) { ((DelegatingConnection)_conn).passivate(); } } finally { _closed = true; } }
protected void passivate() throws SQLException { try { // The JDBC spec requires that a Connection close any open // Statement's when it is closed. // DBCP-288. Not all the traced objects will be statements List traces = getTrace(); if(traces != null) { Iterator traceIter = traces.iterator(); while (traceIter.hasNext()) { Object trace = traceIter.next(); if (trace instanceof Statement) { ((Statement) trace).close(); } else if (trace instanceof ResultSet) { // DBCP-265: Need to close the result sets that are // generated via DatabaseMetaData ((ResultSet) trace).close(); } } clearTrace(); } setLastUsed(0); if(_conn instanceof DelegatingConnection) { ((DelegatingConnection)_conn).passivate(); } } finally { _closed = true; } }