Re: Detecting 'socket errors' - closing the Connection object - Mailing list pgsql-jdbc

From Fernando Nasser
Subject Re: Detecting 'socket errors' - closing the Connection object
Date
Msg-id 3F1D74A2.3060504@redhat.com
Whole thread Raw
In response to Fix for receiving empty query errors.  (Kim Ho <kho@redhat.com>)
List pgsql-jdbc
David Wall wrote:
>>When we get the SQLSTATE patch in you'll be able to do:
>>
>>if ((e.getSQLState() != null) && (e.getSQLState().equals("08S01")))
>>throw new ExplainException("Communication link error: " + e.getMessage());
>
>
> Thanks, Fernando.  Unfortunately, this will be a postgresql-ism, not a JDBC
> library-ism, and it will likely require that the user be on a particular
> version of the database, too (or is this bit going to work even on 7.3 and
> pre 7.3 versions too?).  I'm looking for something that doesn't require a
> special patch for each of the myriad databases our customers use (MSFT SQL
> Server, Oracle, PostgreSQL MySQL and DB2/UDB to name the current list).
>

First of all, this is plain SQL + JDBC specs.

The code falls into the "implementation defined" range, but ODBC, DB2
and Oracle use the same and my patch followed that convention (a sort of
de facto standard for some of these values not pre-defined in the SQL
standard itself).  I don't know if all vendors did the same though -- I
just checked these three.  It is a limitation of the standards that they
did not come out with a more compreheensive set of pre-defined numbers.
  I guess they do spect the applications to cope with the error code
differences somehow.

My patch was originally against 7.3, but it only includes the conditions
detected by the driver.  The backend will only spit SQLSTATEs from 7.4
on (i.e., V# protocol).






--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


pgsql-jdbc by date:

Previous
From: Peter Kovacs
Date:
Subject: Re: Prepared Statements
Next
From: Oana Mitrea
Date:
Subject: unsubscribe me please