Re: SQLException subclasses - Mailing list pgsql-jdbc

From Joe Shevland
Subject Re: SQLException subclasses
Date
Msg-id HEECIHEEJDBMCCGMGIOBAEJGCFAA.jshevland@j-elite.com
Whole thread Raw
In response to SQLException subclasses  (TimothyReaves@westfieldgrp.com)
List pgsql-jdbc
There is work in progress (I think) to have the backend generate integer
error codes based on different occurences; once this occurs the error
numbers are going to be propogated through to the front-end (JDBC driver)
where we will be able to say SQLException.getErrorCode() and perform
different actions for different problems.

ATM, though, I think you're stuck with parsing the messages you get back
:( I have done this for an internal app in a few cases, and it works, but
it very likely to break at some stage (l10n of error messages etc).

Regards,
Joe

>      Has any thought been given to subclassing SQLException to better
> control what happens when an exception occurs?  There is a difference
> between how I would like to handle different things.  Particularly pk
> exceptions.  I'm sure I could parse the text of the exception, but would
a
> DuplicatePrimaryKeyException be better than the generic SQLException?

Attachment

pgsql-jdbc by date:

Previous
From: "Joe Shevland"
Date:
Subject: Re: PostgreSQL+PHP+JDBC+Java Smart Card
Next
From: Cosmin Coroiu
Date:
Subject: Duplicate key identification