Re: SQLException.getErrorCode ?

From: Maxime Lévesque <maxime(dot)levesque(at)gmail(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: SQLException.getErrorCode ?
Date: 2010-05-02 00:17:30
Message-ID: r2u554f5f781005011717jbd45f64g4129c5871434702a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I was just thinking that putting the getSQLState string in the exception's
toString
message would go a long way in hinting the users that postgres does provide
error codes.

Anyways thanks for all the answers ;-)

2010/5/1 Maxime Lévesque <maxime(dot)levesque(at)gmail(dot)com>

>
> The getSQLState method is perfectly fine with me, I was mislead when I
> found
> old posts on the web that said that error codes were not supported at the
> server level.
> I had first tried using the getErrorCode because all other drivers I have
> used
> use this method. I guess making the getSQLState documentation easy
> available
> would be the first thing to do.
>
> Cheers
>
>
>
> On Sat, May 1, 2010 at 3:44 PM, Kris Jurka <books(at)ejurka(dot)com> wrote:
>
>>
>>
>> On Sat, 1 May 2010, Kevin Grittner wrote:
>>
>> Kris Jurka <books(at)ejurka(dot)com> wrote:
>>>
>>> As I said earlier you need to check SQLException.getSQLState, not
>>>> getErrorCode.
>>>>
>>>
>>> Why anyone would want to use error code instead of SQLSTATE is
>>> beyond me, but since they're out there, perhaps we should implement
>>> getErrorCode to interpret SQLSTATE as a base 36 number, and return
>>> that number? It might take less time than fielding the next
>>> complaint. ;-)
>>>
>>> The biggest down side is that we'd have to document it....
>>>
>>>
>> Exactly, who's going to maintain this list of alternate error code
>> versions? If the main project was to put this version of the error codes in
>> the master table of error codes, then I guess it would be OK. I can't
>> imagine proposing that though, unless there are other driver projects that
>> are in the same position.
>>
>> Kris Jurka
>>
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2010-05-02 00:25:51 Re: sending a block through jdbc
Previous Message Maxime Lévesque 2010-05-01 21:41:48 Re: SQLException.getErrorCode ?