pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeffrey Tenny <jeffrey.tenny@comcast.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: "Idle in Transaction" revisited.
Date: Sat, 18 Sep 2004 17:50:59 -0400
Message-ID: <414CADC3.5050907@comcast.net> (raw)

> John R Pierce <pierce@hogranch.com>, pgsql-jdbc@postgresql.org
> 
> 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.

Second that, it's a very bad idea. I once naively had my own transaction 
management using begin/end via jdbc for multi-statement transactions 
against PostgreSQL.
Then the driver was updated at some point and I was getting all kinds
of screwed up commit logic and inconsistent data models.

Stick with and support the proper JDBC interfaces.  Anything else is
platform dependeng, among other bad things.





view thread (28+ messages)  latest in thread

Message-ID: <414CADC3.5050907@comcast.net>
Permalink:  ../414CADC3.5050907@comcast.net/
Also on:    postgresql.org/message-id/414CADC3.5050907@comcast.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: jeffrey.tenny@comcast.net
  Subject: Re: "Idle in Transaction" revisited.
  In-Reply-To: <414CADC3.5050907@comcast.net>
  References: <414CADC3.5050907@comcast.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox