Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 7584B633691 for ; Wed, 21 Oct 2009 19:06:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 94418-06 for ; Wed, 21 Oct 2009 22:06:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id 868A76334EF for ; Wed, 21 Oct 2009 19:06:13 -0300 (ADT) Received: from 122-57-44-76.jetstream.xtra.co.nz ([122.57.44.76] helo=[192.168.1.3]) by tremor.opencloud.co.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1N0jJi-0006Az-JE; Thu, 22 Oct 2009 11:06:02 +1300 Message-ID: <4ADF85C8.6040408@opencloud.com> Date: Thu, 22 Oct 2009 11:06:00 +1300 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Kevin Grittner CC: taktos@gmail.com, pgsql-jdbc@postgresql.org Subject: Re: commit and rollback don't throw exceptions when they should References: <4ADDCCE1020000250002BBEA@gw.wicourts.gov> <4ADF0210.4010100@opencloud.com> <4ADED72A020000250002BC40@gw.wicourts.gov> In-Reply-To: <4ADED72A020000250002BC40@gw.wicourts.gov> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.45 tagged_above=-10 required=5 tests=AWL=0.149, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200910/25 X-Sequence-Number: 20027 Kevin Grittner wrote: > I need to go back and see if any earlier versions conflict with this, > but recent version of the Java API specify that commit and rollback > should throw a SQLException if autoCommit is true. The driver > currently returns without any warning or exception, and without doing > anything. Sounds reasonable. > Java 6 also explicitly mentions that an exception should be > thrown for attempts to use these methods on a closed connection, > although that could arguably fall under the earlier language requiring > an exception when "a database access error occurs" -- since you can't > access a database across a closed connection. Taking a quick look at the code, the driver should already throw an exception on closed connection if any communication with the server is actually needed (if autocommit is on or if no commands have been executed in the current transaction, then it doesn't do any communication and you won't get an exception). Putting an explicit check for a closed connection wouldn't hurt. -O