JDBC Emit SQLStatus for communication link errors

From: Fernando Nasser <fnasser(at)redhat(dot)com>
To: pgsql-patches(at)postgresql(dot)org, blind(at)xythos(dot)com
Subject: JDBC Emit SQLStatus for communication link errors
Date: 2002-11-22 18:05:25
Message-ID: 3DDE71E5.3040906@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

This is a repost of a previous patch with enhancements.

I had to create a specific object for SQLStatus as there are many calls
to PSQLException that pass a string as well, and it is not a SQLStatus
code. Also, the code gets more legible with constants instead of just
the 5 character strings, so I've added those to PSQLException.

I've found 2 more cases where the "08S01" (communication link error)
apply, so I've added those as well. I guess I've found all "08S01" now.

I will proceed with the other "08xxx" cases, now that I have the
official X/Open document in hands. And so one until all cases where we
don't depend on the backend information are covered.

Answering Barry's question with some more detail:

The X/Open codes are basically the same as the ANSI (SQL99) ones.
They do not coder all cases, of course, so there is a provision for
implementation defined codes (some letters are reserved for this purpose).

The "08S01" is not in the standard, but is so common that it is used
everywhere. ODBC defines it, as does DB2 and consequently IBM's JDBC.
Somehow people using MySQL see the same code, but I am not sure how they
were connected, so it may be just an ODBC code. IMO we should use this
value for portability of applications. BTW, Oracle 8i did not implement
SQLStatus (I don't know if that changed).

We will eventually need more custom codes. I will see if the X/Open CLI
spec defines some more codes that we can use. We can also re-use the
ODBC ones that match before inventing new ones. I will also check how
other vendors organized their custom codes.

Anyway, the current patch is just for communication link errors and the
applications really need to be able to detect that the communication
link is broken -- they behave very badly otherwise.

Regards,
Fernando

--
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
JDBCNEWPSQLSTATUS.PATCH text/plain 10.0 KB

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2002-11-22 18:19:40 quote_ident and schemas (was Re: connectby with schema)
Previous Message Masaru Sugawara 2002-11-22 15:50:50 connectby with schema