X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 49CF8329E5C for ; Sat, 18 Sep 2004 11:53:47 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84302-04 for ; Sat, 18 Sep 2004 10:53:40 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 6632A329E55 for ; Sat, 18 Sep 2004 11:53:40 +0100 (BST) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=opencloud.com) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1C8cqP-0006uz-00; Sat, 18 Sep 2004 22:53:29 +1200 Message-ID: <414C13A6.8080407@opencloud.com> Date: Sat, 18 Sep 2004 22:53:26 +1200 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gaetano Mendola Cc: John R Pierce , pgsql-jdbc@postgresql.org Subject: Re: "Idle in Transaction" revisited. References: <0dfb01c49d0e$5c61c1f0$0200a8c0@hogranch.com> <414C0F66.7090507@bigfoot.com> In-Reply-To: <414C0F66.7090507@bigfoot.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/95 X-Sequence-Number: 10985 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