Re: Error codes in JDBC drivers

From: Peter Mount <peter(at)retep(dot)org(dot)uk>
To: Sheer El-Showk <sheer(at)saraf(dot)com>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Error codes in JDBC drivers
Date: 2001-04-10 15:48:20
Message-ID: 5.0.2.1.0.20010410164610.00a34ec0@mail.retep.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

At 15:24 06/04/01 -0400, Sheer El-Showk wrote:
>I'm using what I presume to be the only/most popular JDBC for postgres
>(from http://jdbc.postgresql.org/download; the actual jar is
>jdbc7.0-1.1.jar -- please let me know if there are any others) but am a
>little concerned that its error reporting (via java SQL exceptions) seems
>to use only strings rather then setting the exceptions error code (vendor
>specific or XOPEN standard).
>
>I need to be able to catch SQLExceptions and convert them to my own,
>application specific exceptions ... I can even do this by parsing a string
>(though I would rather an error code), but I don't know how to reliably
>extract DB errors from the exceptions thrown by the postgres JDBC driver.
>
>Any suggestions, references or help would be greatly appreciate.

There was discussion about this a few weeks ago. Implementing the codes is
on hold, as this may endup being a feature being added to the main backend
in 7.2. Until then, I'm afraid parsing the strings is the only way.

Tip: In the source, look at the errors.properties file, it's all the JDBC
specific errors returned. Any others are from the backend.

Peter

Browse pgsql-jdbc by date

  From Date Subject
Next Message Peter Mount 2001-04-10 15:49:56 RE: null to zero?
Previous Message Doug McNaught 2001-04-10 06:14:23 Re: [HACKERS] JDBC and Perl compiling problems w/ postgresql-7.1rc4