Re: SQLException subclasses

From: "Joe Shevland" <jshevland(at)j-elite(dot)com>
To: <TimothyReaves(at)westfieldgrp(dot)com>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: SQLException subclasses
Date: 2002-03-13 03:30:39
Message-ID: HEECIHEEJDBMCCGMGIOBAEJGCFAA.jshevland@j-elite.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Cosmin Coroiu 2002-03-13 06:20:29 Duplicate key identification
Previous Message Joe Shevland 2002-03-13 03:26:13 Re: PostgreSQL+PHP+JDBC+Java Smart Card