Portable interpretation of jdbc SQLException for SERIALIZABLE transaction restart? - Mailing list pgsql-jdbc

From Dave Tenny
Subject Portable interpretation of jdbc SQLException for SERIALIZABLE transaction restart?
Date
Msg-id 3FF31A7C.3040107@comcast.net
Whole thread Raw
Responses Re: Portable interpretation of jdbc SQLException for SERIALIZABLE  (Dave Tenny <jeffrey.tenny@comcast.net>)
List 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.

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: ResultSetMetaData enhancements
Next
From: Dave Tenny
Date:
Subject: Re: Portable interpretation of jdbc SQLException for SERIALIZABLE