| 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: | 3DDAC2EC.1010401@redhat.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| 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
| Attachment | Content-Type | Size | 
|---|---|---|
| JDBCSQLSTATUS.PATCH | text/plain | 4.9 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fernando Nasser | 2002-11-20 01:33:12 | Re: JDBC Emit SQLError code for communication errors | 
| Previous Message | Bruce Momjian | 2002-11-19 17:20:49 | Re: standardize on "canceled" |