commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Re: tomcat and setAutoCommit
Date Thu, 18 Oct 2007 21:31:12 GMT
looks like it is hard coded in commons-dbcp to set autocommit to true

PoolableConnectionFactory.java

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();
        }
    }

If you feel this is incorrect, or cause overhead, then file a bug with 
the DBCP folks

Filip

Kostas Papadopoulos wrote:
> I'm using tomcat/jdbc/mysql with the tomcat suplied DBCP connection
> pool configured with defaultAutoCommit=false. After tracing the
> queries sent to the database, I've noticed that a "set autocommit=1"
> is always followed by "set autocommit=0". I'm not sure who is setting
> "autocommit=1", probably the connection.close()  in the pool
> somewhere.
>
> Is there a way to make it stop? Can anyone know of a reason why this
> would be needed?
>
> Thanks
> Kostas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message