Skip site navigation (1) Skip section navigation (2)

Re: No error code on unique constraint violation

From: Ian Pilcher <i(dot)pilcher(at)comcast(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: No error code on unique constraint violation
Date: 2004-11-29 15:22:01
Message-ID: cofeqp$ptd$1@sea.gmane.org (view raw or flat)
Thread:
Lists: pgsql-jdbc
Laurent Duperval wrote:
> Hello,
> 
> I'm using postgres-jdbc-80b1.308 (type 3) with Postgres 8 beta 5. I'm 
> running some unit tests where I test unique constraint violations. When 
> I get an exception, I check the error code to see what it is and take 
> appropriate action. With SQL Server and Firebird I get a specific error 
> code but with the Postgres driver I get 0. I'm not sure if this is a 
> driver or a Postgres problem.
> 

You need to check the SQLSTATE string -- SQLException.getSQLState().

-- 
========================================================================
Ian Pilcher                                        i(dot)pilcher(at)comcast(dot)net
========================================================================


In response to

Responses

pgsql-jdbc by date

Next:From: Laurent DupervalDate: 2004-11-29 16:05:02
Subject: Re: No error code on unique constraint violation
Previous:From: Laurent DupervalDate: 2004-11-29 14:57:57
Subject: No error code on unique constraint violation

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group