From: Kris Jurka <books@ejurka.com>
To: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: revisiting transaction isolation
Date: Sat, 17 Jul 2004 02:37:23 -0500 (EST)
Message-ID: <Pine.BSO.4.56.0407170233550.32024@leary.csoft.net> (raw)
In-Reply-To: <40F8A692.8000105@opencloud.com>
References: <40F8A692.8000105@opencloud.com>
On Sat, 17 Jul 2004, Oliver Jowett wrote:
> Currently, this type of code will fail:
>
> > conn.setAutoCommit(false);
> > if (conn.getTransactionIsolation() != Connection.TRANSACTION_SERIALIZABLE)
> > conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
>
> The problem is that getTransactionIsolation() issues a query and thus
> starts a new transaction, and then setTransactionIsolation() complains
> you can't change isolation level mid-transaction.
>
> I'm not sure this is reasonable behaviour. One option is to make
> getTransactionIsolation (and what other methods too?) not cause a BEGIN
> to occur if there is no transaction in progress and autocommit is off.
I see no reason for getTransactionIsolation or any driver call to start a
transaction, these are only SELECTs and won't be rolled back anyway.
> On a related topic I just took a look at the JDBC3 spec and it says:
>
> > The return value of the method getTransactionIsolation should reflect
> > the change in isolation level when it actually occurs. It is recommended
> > that drivers implement the setTransactionIsolation method to change the
> > isolation level starting with the next transaction. Committing the
> > current transaction to make the effect immediate is also a valid
> > implementation.
This seems confusing and error prone. I would expect a command I issue to
take effect immediately or throw an Exception, not do nothing now, but
alter later behavior.
Kris Jurka
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: books@ejurka.com, oliver@opencloud.com
Subject: Re: revisiting transaction isolation
In-Reply-To: <Pine.BSO.4.56.0407170233550.32024@leary.csoft.net>
References: <40F8A692.8000105@opencloud.com> <Pine.BSO.4.56.0407170233550.32024@leary.csoft.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