PostgreSQL JDBC - trouble with catching exceptions

From: Serge Dubakov <sad(at)tvs(dot)rk(dot)tusur(dot)ru>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: PostgreSQL JDBC - trouble with catching exceptions
Date: 2001-12-17 07:53:05
Message-ID: 2512618274.20011217145305@tvs.rk.tusur.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

While working on a web application based on FreeBSD/Java/PostgreSQL platform, we ran
into this kind of trouble:

Some exceptions thrown by database are returned to our java code whenever they happen,
while others act very unstable:

- when we connect to database directly through JDBC driver (we tried all the latest versions),
exceptions like

java.sql.SQLException
message: ERROR: fk_trans_reference_money_op referential integrity violation - key referenced from trans not found in money_operation

are NEVER caught. (they DO HAPPEN in reality for sure!)

- when we connect to database through the connection pool (we use the latest version of
PoolMan, http://www.codestudio.com), those kinds of exceptions are caught SOMETIMES.
In other cases, they may be just not be returned at all (though called stored procedure
fails!) or instead of them we get exceptions like

org.postgresql.util.PSQLException
message: No results were returned by the query

which is not adequate.

As a said, exceptions like

java.sql.SQLException
message: ERROR: Cannot insert a duplicate key into unique index ak_key_3_account

are caught ALWAYS (with any method of database connecting).

The problems seems to be in JDBC layer. Does anyone have any ideas or suggestions?

The environment we work in is as follows:

FreeBSD 4.3
JDK 1.3.1
Resin 1.2
PostgreSQL JDBC driver 7.1-1.2
Poolman 2.1
PostgreSQL 7.1.3

--
Serge Dubakov
serge(at)dubakov(dot)com
TV-System LLC

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jens Kießling 2001-12-17 10:03:04
Previous Message Rene Pijlman 2001-12-16 21:43:37 JDK 1.4 challenge, opinions please