pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Maxime Lévesque <maxime.levesque@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: SQLException.getErrorCode ?
Date: Sat, 1 May 2010 12:20:19 -0400 (EDT)
Message-ID: <alpine.BSO.2.00.1005011217130.13830@leary.csoft.net> (raw)
In-Reply-To: <p2m554f5f781005010911te9f69ab9v12f20c3f2139e359@mail.gmail.com>
References: <p2m554f5f781005010911te9f69ab9v12f20c3f2139e359@mail.gmail.com>



On Sat, 1 May 2010, Maxime L?vesque wrote:

>  The method  SQLException.getErrorCode of the jdbc driver systematically
> returns 0,
> 
>  http://www.postgresql.org/docs/8.4/interactive/errcodes-appendix.html

As I said earlier you need to check SQLException.getSQLState, not 
getErrorCode.  As you can see the error conditions listed in the appendix 
are not all numeric so they cannot be returned via getErrorCode.

Kris Jurka


view thread (7+ messages)  latest in thread

Message-ID: <alpine.BSO.2.00.1005011217130.13830@leary.csoft.net>
Permalink:  ../alpine.BSO.2.00.1005011217130.13830@leary.csoft.net/
Also on:    postgresql.org/message-id/alpine.BSO.2.00.1005011217130.13830@leary.csoft.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: books@ejurka.com, maxime.levesque@gmail.com
  Subject: Re: SQLException.getErrorCode ?
  In-Reply-To: <alpine.BSO.2.00.1005011217130.13830@leary.csoft.net>
  References: <p2m554f5f781005010911te9f69ab9v12f20c3f2139e359@mail.gmail.com> <alpine.BSO.2.00.1005011217130.13830@leary.csoft.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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