Jdbc3PoolingDataSource default auto commit is false

From: Ryan Christianson <ryan(at)echospace(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Jdbc3PoolingDataSource default auto commit is false
Date: 2003-04-02 17:55:33
Message-ID: 3E8B2415.2080107@echospace.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ryan Wexler 2003-04-02 19:10:56 Re: prepared statements and sequences
Previous Message Dave Cramer 2003-04-02 17:09:05 Re: prepared statements and sequences