JDBC SQLCodes or Error Numbers - Or how to handle errors - Mailing list pgsql-jdbc

From User One
Subject JDBC SQLCodes or Error Numbers - Or how to handle errors
Date
Msg-id 3BDBB4B3.62A1E600@fictionary.org
Whole thread Raw
Responses Re: JDBC SQLCodes or Error Numbers - Or how to handle errors  (Rene Pijlman <rene@lab.applinet.nl>)
List pgsql-jdbc
I'm new to postgresql and it's JDBC driver, although an old hand a
relation databases.  I'm trying to rely on past practices in developing
some code using Java and postgresql.

I'm trying to do a INSERT into a table with the full knowledge that I
might be trying to insert a duplicate row (which won't be allowed by the
Primary Key).  Since 80% of the inserts will succeed (because I don't
expect many duplicates) I didn't want to waste programming time or
runtime by doing a select to first see if the data existed.  I'm used to
just doing the insert and catching the SQLCODE -803 on DB2 to know that
the row I'm trying to insert already exists.

Is there an easy way to do this using Postgresql and JDBC?

Postgresql version is 7.1.3
JDBC driver is the one that I compiled from the 7.1.3 installation

I'm using the Java SDK 1.3.1_01

-- So is my only hope trying to "match" the error text and determine
what when wrong?

Thanks,
Henry


pgsql-jdbc by date:

Previous
From: Jason Davies
Date:
Subject: DatabaseMetaData.getTables()
Next
From: Rene Pijlman
Date:
Subject: Re: DatabaseMetaData.getTables()