PostgreSQL JDBC - trouble with catching exceptions - Mailing list pgsql-jdbc

From Serge Dubakov
Subject PostgreSQL JDBC - trouble with catching exceptions
Date
Msg-id 2512618274.20011217145305@tvs.rk.tusur.ru
Whole thread Raw
Responses Re: PostgreSQL JDBC - trouble with catching exceptions
List 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
inmoney_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@dubakov.com
TV-System LLC




pgsql-jdbc by date:

Previous
From: David Brownlee
Date:
Subject: Re: date problem with postgres JDBC 7.1 driver
Next
From: "Hunt, Bryan"
Date:
Subject: