From: Oliver Jowett <oliver@opencloud.com>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: taktos@gmail.com
Cc: pgsql-jdbc@postgresql.org
Subject: Re: commit and rollback don't throw exceptions when they should
Date: Thu, 22 Oct 2009 11:06:00 +1300
Message-ID: <4ADF85C8.6040408@opencloud.com> (raw)
In-Reply-To: <4ADED72A020000250002BC40@gw.wicourts.gov>
References: <4ADDCCE1020000250002BBEA@gw.wicourts.gov>
<4ADF0210.4010100@opencloud.com>
<4ADED72A020000250002BC40@gw.wicourts.gov>
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
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: oliver@opencloud.com, Kevin.Grittner@wicourts.gov, taktos@gmail.com
Subject: Re: commit and rollback don't throw exceptions when they should
In-Reply-To: <4ADF85C8.6040408@opencloud.com>
References: <4ADDCCE1020000250002BBEA@gw.wicourts.gov> <4ADF0210.4010100@opencloud.com> <4ADED72A020000250002BC40@gw.wicourts.gov> <4ADF85C8.6040408@opencloud.com>
* 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