Re: jdbc excpetions in pg - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: jdbc excpetions in pg
Date
Msg-id alpine.BSO.2.00.0906031617300.2432@leary.csoft.net
Whole thread Raw
In response to jdbc excpetions in pg  ("Thomas Finneid" <tfinneid@fcon.no>)
Responses Re: jdbc excpetions in pg  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-jdbc

On Wed, 3 Jun 2009, Thomas Finneid wrote:

> I was looking at the documentation for the pg jdbc driver and it seems to
> me that the driver throws SQLExceptions only, or mostly. I.e. the driver
> does not create any subclasses of the SQLException class. Is this correct?

Yes.  The JDBC4 spec has created subclasses of SQLException to indicate
different failure modes, but the pg driver has not implemented that yet.

> If so, what is the suggested method for classifying the errors to more
> detail than SQLException? I was hoping to make my code more robust by
> dealing with the errors more appropriately.

You should check the SQLState of the SQLException to determine the type of
problem encountered.

Kris Jurka

pgsql-jdbc by date:

Previous
From: User
Date:
Subject: Strings with Null Bytes Causing Exceptions
Next
From: Kris Jurka
Date:
Subject: Re: Headless Exception