Skip site navigation (1) Skip section navigation (2)

JDBC Emit SQLError code for communication errors

From: Fernando Nasser <fnasser(at)redhat(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: JDBC Emit SQLError code for communication errors
Date: 2002-11-19 23:02:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Applications can't rely on the text of the SQLException error message to 
detect that there was a communication error as it is localized (and 
error messages are prone to change anyway).  So, a JDBC application 
cannot take the appropriate actions when an IO error occurs.

This patch makes the JDBC driver report an eof and other communication 
errors using the standard SQLSTATE value:

   "08S01"  (connection exception-communication link failure)

which can be safely tested for in applications.  Without this patch we 
get null, instead of the "08S01" string, when calling getSQLState() as 
the driver never sets that value.

The behavior of applications when we lose connection with the backend is 
currently very bad, as there is no way to distinguish this problem from 
a regular SQL error.

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

Description: text/plain (4.9 KB)


pgsql-patches by date

Next:From: Fernando NasserDate: 2002-11-20 01:33:12
Subject: Re: JDBC Emit SQLError code for communication errors
Previous:From: Bruce MomjianDate: 2002-11-19 17:20:49
Subject: Re: standardize on "canceled"

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group