Thread: Fixing SQLException error codes.

Fixing SQLException error codes.

From
Martin Algesten
Date:
Hi all!

I would like to have the problem with the getErrorCode in SQLException
always returning 0 fixed. So I figured, why don't do it myself? ... Just tot
check before I start looking at it...

Has there been any attempt fixing it? Are someone doing it anyway? Are there
any known problems with doing it?

Cheers,
Martin


RE: Fixing SQLException error codes.

From
Joe Shevland
Date:
This would be a very handy feature, Oracle's JDBC implementation does this
and it makes it nice and easy to produce descriptive error messages for the
end user (among other things).

I'm wondering if there are standard error codes returned by the backend or
whether you need to create new ones. I can't see there being any problem
with it though. I've got a few links to the Oracle JDBC error codes if you
want a reference.

Regards,
Joe

> -----Original Message-----
> From: Martin Algesten [mailto:martin@taglab.com]
> Sent: Sunday, 24 June 2001 7:41 PM
> To: pgsql-jdbc@postgresql.org
> Subject: [JDBC] Fixing SQLException error codes.
>
>
> Hi all!
>
> I would like to have the problem with the getErrorCode in SQLException
> always returning 0 fixed. So I figured, why don't do it
> myself? ... Just tot
> check before I start looking at it...
>
> Has there been any attempt fixing it? Are someone doing it
> anyway? Are there
> any known problems with doing it?
>
> Cheers,
> Martin
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>

Re: Fixing SQLException error codes.

From
Martin Algesten
Date:
Well yeah... that is the question.. Does the backend have standardised error
codes... I hoped someone could point me in the right direction before I do
anything that isn't useful in the long run.

M

On 24/6/01 11:16, "Joe Shevland" <J.Shevland@eclipsegroup.com.au> wrote:

> This would be a very handy feature, Oracle's JDBC implementation does this
> and it makes it nice and easy to produce descriptive error messages for the
> end user (among other things).
>
> I'm wondering if there are standard error codes returned by the backend or
> whether you need to create new ones. I can't see there being any problem
> with it though. I've got a few links to the Oracle JDBC error codes if you
> want a reference.
>
> Regards,
> Joe
>
>> -----Original Message-----
>> From: Martin Algesten [mailto:martin@taglab.com]
>> Sent: Sunday, 24 June 2001 7:41 PM
>> To: pgsql-jdbc@postgresql.org
>> Subject: [JDBC] Fixing SQLException error codes.
>>
>>
>> Hi all!
>>
>> I would like to have the problem with the getErrorCode in SQLException
>> always returning 0 fixed. So I figured, why don't do it
>> myself? ... Just tot
>> check before I start looking at it...
>>
>> Has there been any attempt fixing it? Are someone doing it
>> anyway? Are there
>> any known problems with doing it?
>>
>> Cheers,
>> Martin
>>
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 1: subscribe and unsubscribe commands go to
>> majordomo@postgresql.org
>>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>   (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>


Re: Fixing SQLException error codes.

From
Bruce Momjian
Date:
> Well yeah... that is the question.. Does the backend have standardised error
> codes... I hoped someone could point me in the right direction before I do
> anything that isn't useful in the long run.

Peter E added internationalized error messages for 7.2.  I wonder if
that could be easily extended with error codes.  A sample is in
/pg/backend/po/de.po.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Fixing SQLException error codes.

From
Peter Eisentraut
Date:
Martin Algesten writes:

> I would like to have the problem with the getErrorCode in SQLException
> always returning 0 fixed. So I figured, why don't do it myself? ... Just tot
> check before I start looking at it...
>
> Has there been any attempt fixing it? Are someone doing it anyway? Are there
> any known problems with doing it?

This issue is not unrelated to the fact that the server doesn't provide
any error codes in the first place, so the JDBC driver will have a hard
time guessing them.  Fixing this is in the (my) agenda; it may or may not
happen for the next major release.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: Fixing SQLException error codes.

From
Barry Lind
Date:
 No, the backend does not have proper error codes.  See the TODO list
 item "Allow elog() to return error codes, module name, file name, line
 number, not just messages (Peter E) [elog]"
 (http://www.postgresql.org/docs/todo.html)

 It doesn't make sense to do this in JDBC until the server first
 supports error codes.  If you want to contribute, it would be best to
 help getting this into the core server so that all interfaces, not
 just JDBC can take advantage of it.

 thanks,
 --Barry

 PS. I agree this would be nice to have in core as well as JDBC.


>> Martin Algesten wrote:
>>
>>> Well yeah... that is the question.. Does the backend have
>>> standardised error
>>> codes... I hoped someone could point me in the right direction before
>>> I do
>>> anything that isn't useful in the long run.
>>>
>>> M
>>>
>>> On 24/6/01 11:16, "Joe Shevland" <J.Shevland@eclipsegroup.com.au> wrote:
>>>
>>>
>>>> This would be a very handy feature, Oracle's JDBC implementation
>>>> does this
>>>> and it makes it nice and easy to produce descriptive error messages
>>>> for the
>>>> end user (among other things).
>>>>
>>>> I'm wondering if there are standard error codes returned by the
>>>> backend or
>>>> whether you need to create new ones. I can't see there being any
>>>> problem
>>>> with it though. I've got a few links to the Oracle JDBC error codes
>>>> if you
>>>> want a reference.
>>>>
>>>> Regards,
>>>> Joe
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: Martin Algesten [mailto:martin@taglab.com]
>>>>> Sent: Sunday, 24 June 2001 7:41 PM
>>>>> To: pgsql-jdbc@postgresql.org
>>>>> Subject: [JDBC] Fixing SQLException error codes.
>>>>>
>>>>>
>>>>> Hi all!
>>>>>
>>>>> I would like to have the problem with the getErrorCode in SQLException
>>>>> always returning 0 fixed. So I figured, why don't do it
>>>>> myself? ... Just tot
>>>>> check before I start looking at it...
>>>>>
>>>>> Has there been any attempt fixing it? Are someone doing it
>>>>> anyway? Are there
>>>>> any known problems with doing it?
>>>>>
>>>>> Cheers,
>>>>> Martin
>>>>>
>>>>>
>>>>> ---------------------------(end of
>>>>> broadcast)---------------------------
>>>>> TIP 1: subscribe and unsubscribe commands go to
>>>>> majordomo@postgresql.org
>>>>>
>>>>>
>>>> ---------------------------(end of
>>>> broadcast)---------------------------
>>>> TIP 2: you can get off all lists at once with the unregister command
>>>>  (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>>>>
>>>>
>>>
>>>
>>> ---------------------------(end of broadcast)---------------------------
>>> TIP 3: if posting/reading through Usenet, please send an appropriate
>>> subscribe-nomail command to majordomo@postgresql.org so that your
>>> message can get through to the mailing list cleanly
>>>
>>>
>>
>>
>
>



Re: Fixing SQLException error codes.

From
Barry Lind
Date:

Barry Lind wrote:

> No, the backend does not have proper error codes.  See the TODO list
> item "Allow elog() to return error codes, module name, file name, line
> number, not just messages (Peter E) [elog]"
> (http://www.postgresql.org/docs/todo.html)
>
> It doesn't make sense to do this in JDBC until the server first supports
> error codes.  If you want to contribute, it would be best to help
> getting this into the core server so that all interfaces, not just JDBC
> can take advantage of it.
>
> thanks,
> --Barry
>
> PS. I agree this would be nice to have in core as well as JDBC.
>
>
> Martin Algesten wrote:
>
>> Well yeah... that is the question.. Does the backend have standardised
>> error
>> codes... I hoped someone could point me in the right direction before
>> I do
>> anything that isn't useful in the long run.
>>
>> M
>>
>> On 24/6/01 11:16, "Joe Shevland" <J.Shevland@eclipsegroup.com.au> wrote:
>>
>>
>>> This would be a very handy feature, Oracle's JDBC implementation does
>>> this
>>> and it makes it nice and easy to produce descriptive error messages
>>> for the
>>> end user (among other things).
>>>
>>> I'm wondering if there are standard error codes returned by the
>>> backend or
>>> whether you need to create new ones. I can't see there being any problem
>>> with it though. I've got a few links to the Oracle JDBC error codes
>>> if you
>>> want a reference.
>>>
>>> Regards,
>>> Joe
>>>
>>>
>>>> -----Original Message-----
>>>> From: Martin Algesten [mailto:martin@taglab.com]
>>>> Sent: Sunday, 24 June 2001 7:41 PM
>>>> To: pgsql-jdbc@postgresql.org
>>>> Subject: [JDBC] Fixing SQLException error codes.
>>>>
>>>>
>>>> Hi all!
>>>>
>>>> I would like to have the problem with the getErrorCode in SQLException
>>>> always returning 0 fixed. So I figured, why don't do it
>>>> myself? ... Just tot
>>>> check before I start looking at it...
>>>>
>>>> Has there been any attempt fixing it? Are someone doing it
>>>> anyway? Are there
>>>> any known problems with doing it?
>>>>
>>>> Cheers,
>>>> Martin
>>>>
>>>>
>>>> ---------------------------(end of
>>>> broadcast)---------------------------
>>>> TIP 1: subscribe and unsubscribe commands go to
>>>> majordomo@postgresql.org
>>>>
>>>>
>>> ---------------------------(end of broadcast)---------------------------
>>> TIP 2: you can get off all lists at once with the unregister command
>>>  (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>>>
>>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 3: if posting/reading through Usenet, please send an appropriate
>> subscribe-nomail command to majordomo@postgresql.org so that your
>> message can get through to the mailing list cleanly
>>
>>
>
>