Request to check isolation level before throwing exception

From: Ben Weber <bgweber(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Request to check isolation level before throwing exception
Date: 2009-07-30 22:18:44
Message-ID: e28334cd0907301518l4255036cj4e9ce960f80f27a9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I am using atomikos 3.5.6. with Postgres 8.4 and have ran into the following
problem: Cannot change transaction isolation level in the middle of a
transaction. Due to the way that Atomikos manages the Pool of XA
connections, I cannot prevent setTransactionIsolation from being called in
the middle of transactions. I would like to propose a simple fix for this
issue. The setTransactionIsolation method should check the current isolation
level before throwing an exception.

Proposed fix in AbstractJdbc2Connection.java:

public void setTransactionIsolation(int level) throws SQLException
{

// check current level before proceeding
if (level == getTransactionIsolation()) {
return;
}

......

}

I have tested this patch in my environment and it fixed the problem. Is it
possible to get this change committed to the main build?

Thanks,
Ben Weber

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ben Weber 2009-07-30 22:54:42 unnecessary exception patch
Previous Message JUNG, Christian 2009-07-30 11:20:09 setting the role with the URL connection string