Better error messages from JDBC - Mailing list pgsql-general

From Reuven M. Lerner
Subject Better error messages from JDBC
Date
Msg-id 14724.15134.386365.578715@martin-buber.lerner.co.il
Whole thread Raw
List pgsql-general
Hi, folks.  I've been using PostgreSQL over the last six months or so
(after a bitter experience 2-3 years ago), and have been
overwhelmingly pleased with what I see.  Good job, all you core
developers!

My question is whether I can get better error messages from JDBC than
the text of an SQLException.  I know that if something goes wrong
during a transaction, the SQLException will be thrown, and I can get
lots of interesting information out of that.  But it would be nice to
be able to produce a beautifully formatted error message for the user,
and to catch certain errors, rather than simply pass text to the user.

(For example, if a given column has a "CHECK colname <> ''", I would
like to be able to tell the user that a column shouldn't be left
blank.  I could obviously check this at the application level as well,
and that's what I expect to end up doing -- but I wouldn't mind
getting a bit of help from the database.

Also: Perl provides a (slow, but cool) means to retrieve a row as a
hash, in which the keys are the column names and the values are the
actual column values.  Is there any such function for the PostgreSQL
JDBC driver, perhaps using Hashtables?  Is there any method for
retrieving lots of rows at once, rather than one by one?

Thanks for any advice you can offer!

Reuven


pgsql-general by date:

Previous
From: dave
Date:
Subject: Re: [PHP-INST] problem compiling php for pgsql
Next
From: Paul Caskey
Date:
Subject: Re: Re: 4 billion record limit?