Jdbc3PoolingDataSource default auto commit is false - Mailing list pgsql-jdbc

From Ryan Christianson
Subject Jdbc3PoolingDataSource default auto commit is false
Date
Msg-id 3E8B2415.2080107@echospace.com
Whole thread Raw
Responses Re: Jdbc3PoolingDataSource default auto commit is false
List pgsql-jdbc
Hi.

I am useing Jdbc3PoolingDataSource to do database pooling. When I first
started using it some of my updates where not taking effect. So I
started enabled postgres logging and watched my queries, and I found out
why. The Jdbc3PoolingDataSource by default sets setDefaultAutoCommit to
false, and because of that, after every query it was calling "rollback".

To fix it, I extended Jdbc3PoolingDataSource, over-wrote the
createConnectionPool like so:
    protected ConnectionPool createConnectionPool() {
        ConnectionPool pool = super.createConnectionPool();
        pool.setDefaultAutoCommit(true);
        return pool;
    }

So my question is, how should I have worked with defaultAutoCommit set
to true? Would I need to wrap all of my queries in begin; and commit; ?

Thanks


pgsql-jdbc by date:

Previous
From: Barry Lind
Date:
Subject: Re: Changing transaction isolation mid-transaction
Next
From: Ryan Wexler
Date:
Subject: Re: prepared statements and sequences