Re: Detecting 'socket errors' - closing the Connection object

From: Fernando Nasser <fnasser(at)redhat(dot)com>
To: David Wall <d(dot)wall(at)computer(dot)org>
Cc: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Detecting 'socket errors' - closing the Connection object
Date: 2003-07-22 17:30:10
Message-ID: 3F1D74A2.3060504@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)redhat(dot)com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message peter royal 2003-07-22 17:30:24 Re: the IN clause saga
Previous Message scott.marlowe 2003-07-22 17:22:42 Re: inet type handling