Re: Another exception (Transaction level)

From: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
To: "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Another exception (Transaction level)
Date: 2003-07-25 12:52:28
Message-ID: 20030725135228.A21371@bacon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


On 25/07/2003 13:09 Ole Streicher wrote:
> Hi,
>
> sorry if I flood you with lots of messages, but I am quite new to
> Postgresql and I find a lot of questions not answered in the manual.
>
> I get randomly (probably when I have concurrent r/w access) the error
> message
>
> java.sql.SQLException: ERROR: SET TRANSACTION ISOLATION LEVEL must be
> called before any query
>
> when I do a commit(). But I had set this level at the very beginning with
>
> dbConn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);

Do you do this before or after dbConn.setAutoCommit(false). I think you
need to do it before (that's what I deo any I've had a problem) as calling
setAutoCommit(false) actually causes the driver to issue a BEGIN; to the
back-end to start a transaction.
>
> BTW, I tried to use TRANSACTION_READ_UNCOMMITTED (which is described
> in the manual) but in this case I get "Transaction isolation level 1
> is not supported."
>
> What is wrong here? Why do I get an error message when I try to use
> the "read uncommitted" level, and why I get the exception when I use
> commit() after setting the transaction level to "read committed"?
>

I don't believe that read uncommitted is supported by PostgreSQL.

HTH

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ole Streicher 2003-07-25 13:16:35 Re: Another exception (Transaction level)
Previous Message Felipe Schnack 2003-07-25 12:18:59 Re: quick question about PreparedStatements