Portable interpretation of jdbc SQLException for SERIALIZABLE transaction restart?

From: Dave Tenny <jeffrey(dot)tenny(at)comcast(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Portable interpretation of jdbc SQLException for SERIALIZABLE transaction restart?
Date: 2003-12-31 18:50:36
Message-ID: 3FF31A7C.3040107@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I'm getting the following /expected/ exception:

java.sql.SQLException: ERROR: Can't serialize access due to concurrent
update

at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:505)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:197)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:183)
at DbMutex.updateRow(DbMutex.java:70)
at DbMutex.run(DbMutex.java:38)

So I know I need to restart my transaction. What I don't know
is how to portably interpret this particular SQLException instance as one
that justifies a transaction restart, as opposed to the myriad other
types of SQLExceptions I might get.

So two questions:

1) How do I know this is an exception indicative of the need for a
transaction restart in PostgreSQL?
2) How do I do this portably? (I.e. in a database neutral fashion).

The Sun spec on SQLException talks about XOPEN SQLstate interpretation,
I'm still looking for documentation on that puppy. It also talks about
SQL99.
At this point I'm unsure which applies to this exception for postgresql.

I'm using PostgreSQL 7.3.3 and Java 1.4.2 on linux, though hopefully
none of that
makes a difference.

Thanks for any tips.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Tenny 2003-12-31 18:57:22 Re: Portable interpretation of jdbc SQLException for SERIALIZABLE
Previous Message Kris Jurka 2003-12-31 17:08:15 Re: ResultSetMetaData enhancements