Re: "Idle in Transaction" revisited. - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: "Idle in Transaction" revisited.
Date
Msg-id 414C13A6.8080407@opencloud.com
Whole thread Raw
In response to Re: "Idle in Transaction" revisited.  (Gaetano Mendola <mendola@bigfoot.com>)
Responses Re: "Idle in Transaction" revisited.
List pgsql-jdbc
Gaetano Mendola wrote:
> John R Pierce wrote:
>
>> I'm curious what common practice is for threads that do nothing but
>> SELECTS... do folks just enable auto_commit, thereby preventing pgJDBC
>> from doing BEGIN; ?  Do they lace their code with COMMIT() calls?
>
>
> We were bitten by this problem too, and my solution was to suggest our
> developer to do and explicit: "ABORT" after the connection, and do
> explicit "BEGIN"   "END"  instead of rely on the jdbc interface.

This is a pretty bad idea as it can confuse the driver's idea of the
current transaction state. For example, cursor-based resultsets won't
ever be used if you do your own transaction demarcation in this way.

Better to use the standard JDBC autocommit API and a driver that has the
premature-BEGIN problem fixed.

-O

pgsql-jdbc by date:

Previous
From: Gaetano Mendola
Date:
Subject: Re: "Idle in Transaction" revisited.
Next
From: Gaetano Mendola
Date:
Subject: Re: "Idle in Transaction" revisited.