commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Crowley <stephen.crow...@gmail.com>
Subject [dbcp] PoolableConnectionFactory.passivateObject() setting autoCommit(true) ?!
Date Thu, 02 Jun 2005 18:15:18 GMT
I've been experiencing very odd behaviour with regard to autocommit and 
abandoned connections. It seems that when connections are reclaimed that 
autocommit somehow becomes set to true. 

public void passivateObject(Object obj) throws Exception {
if(obj instanceof Connection) {
Connection conn = (Connection)obj;
if(!conn.getAutoCommit() && !conn.isReadOnly()) {
conn.rollback();
}
conn.clearWarnings();
conn.setAutoCommit(true);
}
if(obj instanceof DelegatingConnection) {
((DelegatingConnection)obj).passivate();
}
}


How can conn.setAutoCommit(true) possibly be the correct behaviour here? Is 
this correct?

Thanks,
Stephen

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message