Re: jdbc excpetions in pg

From: Kris Jurka <books(at)ejurka(dot)com>
To: Thomas Finneid <tfinneid(at)fcon(dot)no>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: jdbc excpetions in pg
Date: 2009-06-03 20:19:05
Message-ID: alpine.BSO.2.00.0906031617300.2432@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2009-06-03 20:39:21 Re: Headless Exception
Previous Message User 2009-06-03 19:25:36 Strings with Null Bytes Causing Exceptions