pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Владимир Лашин <lash@donenergo.ru>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Sun Java Creatror2  postgresql 8.1
Date: Tue, 18 Apr 2006 01:38:26 -0500 (EST)
Message-ID: <Pine.BSO.4.63.0604180120060.21483@leary2.csoft.net> (raw)
In-Reply-To: <1145338200.6717.22.camel@gp12ito07.donenergo.net>
References: <1145338200.6717.22.camel@gp12ito07.donenergo.net>



On Tue, 18 Apr 2006, ÷ÌÁÄÉÍÉÒ ìÁÛÉÎ wrote:

> But "someDataProvider.commitChanges()" works only first time.
> Then the only message i get after "someDataProvider.commitChanges()" is
> "can't change isolation level in the middle of transaction".

This is a known issue, please see the archives for the history of it.

I did have a new thought about it today though.  Perhaps the application 
isn't doing something like:

conn.setAutoCommit(false);
conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
conn.createStatement().execute("SELECT ..");
conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);

but instead is simply resetting the transaction isolation to the current
value.  That seems like a poorly coded application, but not one as broken 
as trying to actually change the value.  The case of setting the 
isolation level to the current isolation is really a no-op, so we could 
allow that.

The attached patch implements this check although a more complete version 
should do some sort of caching of the isolation level to avoid server 
calls.

Could you please try out one of the jar files here and report back as to 
whether that fixes your problem?

http://www.ejurka.com/pgsql/jars/lash/

Kris Jurka

Attachments:

unchanged-isolation.patch (text/plain, 977B) download Index: org/postgresql/jdbc2/AbstractJdbc2Connection.java =================================================================== RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java,v retrieving revision 1.32 diff -c -r1.32 AbstractJdbc2Connection.java *** org/postgresql/jdbc2/AbstractJdbc2Connection.java 1 Aug 2005 06:54:14 -0000 1.32 --- org/postgresql/jdbc2/AbstractJdbc2Connection.java 18 Apr 2006 06:34:52 -0000 *************** *** 725,730 **** --- 725,733 ---- */ public void setTransactionIsolation(int level) throws SQLException { + if (getTransactionIsolation() == level) + return; + if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE) throw new PSQLException(GT.tr("Cannot change transaction isolation level in the middle of a transaction."), PSQLState.ACTIVE_SQL_TRANSACTION);

view thread (2+ messages)

Message-ID: <Pine.BSO.4.63.0604180120060.21483@leary2.csoft.net>
Permalink:  ../Pine.BSO.4.63.0604180120060.21483@leary2.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.63.0604180120060.21483@leary2.csoft.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: books@ejurka.com, lash@donenergo.ru
  Subject: Re: Sun Java Creatror2  postgresql 8.1
  In-Reply-To: <Pine.BSO.4.63.0604180120060.21483@leary2.csoft.net>
  References: <1145338200.6717.22.camel@gp12ito07.donenergo.net> <Pine.BSO.4.63.0604180120060.21483@leary2.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