pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedSQLException and error code
8+ messages / 4 participants
[nested] [flat]
* SQLException and error code
@ 2005-07-26 13:19 Peter.Zoche@materna.de
2005-07-26 14:04 ` Re: SQLException and error code Oliver Jowett <oliver@opencloud.com>
0 siblings, 1 reply; 8+ messages in thread
From: Peter.Zoche@materna.de @ 2005-07-26 13:19 UTC (permalink / raw)
To: pgsql-jdbc
Hi!
I am using postgresql-8.0-310.jdbc3.jar in my application.
In order to get the error code from an SQLException I have
to use sqlexception.getSQLState(). Shouldn't it be
getErrorCode()?
Peter
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: SQLException and error code
2005-07-26 13:19 SQLException and error code Peter.Zoche@materna.de
@ 2005-07-26 14:04 ` Oliver Jowett <oliver@opencloud.com>
0 siblings, 0 replies; 8+ messages in thread
From: Oliver Jowett @ 2005-07-26 14:04 UTC (permalink / raw)
To: Peter.Zoche@materna.de; +Cc: pgsql-jdbc
Peter.Zoche@materna.de wrote:
> I am using postgresql-8.0-310.jdbc3.jar in my application.
> In order to get the error code from an SQLException I have
> to use sqlexception.getSQLState(). Shouldn't it be
> getErrorCode()?
We get a SQLSTATE from the server already, so it makes sense to make
that available via getSQLState().
What exactly do you suggest we return from getErrorCode()?
-O
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: SQLException and error code
@ 2005-07-26 14:17 Peter.Zoche@materna.de
2005-07-26 16:54 ` Re: SQLException and error code Kris Jurka <books@ejurka.com>
2005-07-26 23:33 ` Re: SQLException and error code Oliver Jowett <oliver@opencloud.com>
0 siblings, 2 replies; 8+ messages in thread
From: Peter.Zoche@materna.de @ 2005-07-26 14:17 UTC (permalink / raw)
To: pgsql-jdbc
Because in the postgresql documentation you can find the following page:
http://www.postgresql.org/docs/8.0/interactive/errcodes-appendix.html#ERRCOD
ES-TABLE
There you can see all ERROR CODES!
So why is there a method getErrorCode(), if the only thing it does
is to return zero?
-----Ursprüngliche Nachricht-----
Von: Oliver Jowett [mailto:oliver@opencloud.com]
Gesendet: Dienstag, 26. Juli 2005 16:04
An: Peter.Zoche@materna.de
Cc: pgsql-jdbc@postgresql.org
Betreff: Re: [JDBC] SQLException and error code
Peter.Zoche@materna.de wrote:
> I am using postgresql-8.0-310.jdbc3.jar in my application.
> In order to get the error code from an SQLException I have
> to use sqlexception.getSQLState(). Shouldn't it be
> getErrorCode()?
We get a SQLSTATE from the server already, so it makes sense to make
that available via getSQLState().
What exactly do you suggest we return from getErrorCode()?
-O
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: SQLException and error code
2005-07-26 14:17 Re: SQLException and error code Peter.Zoche@materna.de
@ 2005-07-26 16:54 ` Kris Jurka <books@ejurka.com>
1 sibling, 0 replies; 8+ messages in thread
From: Kris Jurka @ 2005-07-26 16:54 UTC (permalink / raw)
To: Peter.Zoche@materna.de; +Cc: pgsql-jdbc
On Tue, 26 Jul 2005 Peter.Zoche@materna.de wrote:
> Because in the postgresql documentation you can find the following page:
>
> http://www.postgresql.org/docs/8.0/interactive/errcodes-appendix.html#ERRCOD
> ES-TABLE
>
> There you can see all ERROR CODES!
>
> So why is there a method getErrorCode(), if the only thing it does
> is to return zero?
The table is mislabeled a little bit, these are actually SQL State codes.
Note that getErrorCode returns an int, so certainly couldn't return a sql
state like "0100C".
Kris Jurka
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: SQLException and error code
2005-07-26 14:17 Re: SQLException and error code Peter.Zoche@materna.de
@ 2005-07-26 23:33 ` Oliver Jowett <oliver@opencloud.com>
1 sibling, 0 replies; 8+ messages in thread
From: Oliver Jowett @ 2005-07-26 23:33 UTC (permalink / raw)
To: Peter.Zoche@materna.de; +Cc: pgsql-jdbc
Peter.Zoche@materna.de wrote:
> Because in the postgresql documentation you can find the following page:
>
> http://www.postgresql.org/docs/8.0/interactive/errcodes-appendix.html#ERRCOD
> ES-TABLE
>
> There you can see all ERROR CODES!
Those codes are actually SQLSTATEs.
> So why is there a method getErrorCode(),
It's defined by the JDBC spec, we don't have any choice about whether it
is there or not.
> if the only thing it does
> is to return zero?
Back to my original question: what are you expecting it to return? It
can't return a SQLSTATE because it returns an int and SQLSTATE is
alphanumeric. We don't have any other useful error code. So we just
return 0 because we have to return *something*.
-O
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: SQLException and error code
@ 2005-07-28 15:13 Kevin Grittner <Kevin.Grittner@wicourts.gov>
2005-07-29 00:31 ` Re: SQLException and error code Oliver Jowett <oliver@opencloud.com>
0 siblings, 1 reply; 8+ messages in thread
From: Kevin Grittner @ 2005-07-28 15:13 UTC (permalink / raw)
To: Peter.Zoche@materna.de; oliver@opencloud.com; +Cc: pgsql-jdbc
To better support existing applications which (for reasons I don't
really understand) rely on the vendor-specific errorCode instead of the
ANSI-standard sqlState, you could implement getErrorCode as:
return Integer.parseInt(getSqlState(), 36);
-Kevin
>>> Oliver Jowett <oliver@opencloud.com> 07/26/05 6:33 PM >>>
Peter.Zoche@materna.de wrote:
> Because in the postgresql documentation you can find the following
page:
>
>
http://www.postgresql.org/docs/8.0/interactive/errcodes-appendix.html#ERRCOD
> ES-TABLE
>
> There you can see all ERROR CODES!
Those codes are actually SQLSTATEs.
> So why is there a method getErrorCode(),
It's defined by the JDBC spec, we don't have any choice about whether it
is there or not.
> if the only thing it does
> is to return zero?
Back to my original question: what are you expecting it to return? It
can't return a SQLSTATE because it returns an int and SQLSTATE is
alphanumeric. We don't have any other useful error code. So we just
return 0 because we have to return *something*.
-O
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: SQLException and error code
2005-07-28 15:13 Re: SQLException and error code Kevin Grittner <Kevin.Grittner@wicourts.gov>
@ 2005-07-29 00:31 ` Oliver Jowett <oliver@opencloud.com>
0 siblings, 0 replies; 8+ messages in thread
From: Oliver Jowett @ 2005-07-29 00:31 UTC (permalink / raw)
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>; +Cc: Peter.Zoche@materna.de; pgsql-jdbc
Kevin Grittner wrote:
> To better support existing applications which (for reasons I don't
> really understand) rely on the vendor-specific errorCode instead of the
> ANSI-standard sqlState, you could implement getErrorCode as:
>
> return Integer.parseInt(getSqlState(), 36);
Ow! It seems a bit pointless though, honestly..
Going to wait for a reply from the original poster, I still don't
understand what Peter wants getErrorCode() to return..
-O
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: SQLException and error code
@ 2005-07-29 06:53 Peter.Zoche@materna.de
0 siblings, 0 replies; 8+ messages in thread
From: Peter.Zoche@materna.de @ 2005-07-29 06:53 UTC (permalink / raw)
To: pgsql-jdbc
I only have been confused by the naming of the following page:
http://www.postgresql.org/docs/8.0/interactive/errcodes-appendix.html
Its called "Appendix A. PostgreSQL Error Codes", so getErrorCode()
seems to be the best method! But confusion is cleared now.
Peter
Kevin Grittner wrote:
> To better support existing applications which (for reasons I don't
> really understand) rely on the vendor-specific errorCode instead of the
> ANSI-standard sqlState, you could implement getErrorCode as:
>
> return Integer.parseInt(getSqlState(), 36);
Ow! It seems a bit pointless though, honestly..
Going to wait for a reply from the original poster, I still don't
understand what Peter wants getErrorCode() to return..
-O
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2005-07-29 06:53 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-07-26 13:19 SQLException and error code Peter.Zoche@materna.de
2005-07-26 14:04 ` Oliver Jowett <oliver@opencloud.com>
2005-07-26 14:17 Re: SQLException and error code Peter.Zoche@materna.de
2005-07-26 16:54 ` Kris Jurka <books@ejurka.com>
2005-07-26 23:33 ` Oliver Jowett <oliver@opencloud.com>
2005-07-28 15:13 Re: SQLException and error code Kevin Grittner <Kevin.Grittner@wicourts.gov>
2005-07-29 00:31 ` Oliver Jowett <oliver@opencloud.com>
2005-07-29 06:53 Re: SQLException and error code Peter.Zoche@materna.de
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox