db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-2601) Server SQLException error codes are not returned to client
Date Fri, 25 May 2012 10:26:23 GMT

    [ https://issues.apache.org/jira/browse/DERBY-2601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13283288#comment-13283288
] 

Knut Anders Hatlen commented on DERBY-2601:
-------------------------------------------

One note about client/server compatibility.

If, for example, a transaction-severity error happens on the server,
the server sees an exception whose getErrorCode() method returns
30000. Here's what getErrorCode() on the client-side exception will
return for the various combinations of new and old servers and
clients:

(old server, old client) -> -1
(old server, new client) -> 0
(new server, old client) -> -30001
(new server, new client) -> 30000

("old" means any version without the fix, "new" means any version with
the fix)

With an old server and a new client, 0 is returned because the old
servers always send SQLCODE -1, and the client converts that to an
error code by adding one and changing the sign. Since 0 matches
ExceptionSeverity.NO_APPLICABLE_SEVERITY (intended for "when the
system was unable to determine the severity"), I think it's slightly
less wrong than -1. But if someone thinks returning -1, as we did
before, is better, and that it's worthwhile adding logic to handle
that, it should be possible to change it.

With a new server and an old client, the server will send an SQLCODE
that encodes the original error code, but the client doesn't know how
to transform that back to an error code, and will return the SQLCODE
unchanged (-30001). Again, it should be possible to make the server
send SQLCODE -1 when it's talking to an old client. However, since we
don't document the error codes, and since -30001 is no more or less
correct than -1 (they're both wrong), I'm not sure if it's worth
adding special handling of this case. Maybe a release note?
                
> Server SQLException error codes are not returned to client
> ----------------------------------------------------------
>
>                 Key: DERBY-2601
>                 URL: https://issues.apache.org/jira/browse/DERBY-2601
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions: 10.3.1.4
>            Reporter: Kathey Marsden
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>              Labels: derby_triage10_9
>         Attachments: d2601-1a.diff
>
>
> ErrorCodes from returned SQLExceptions are not retained in client.  e.g. in the example
below, client reports an errorcode of -1 instead of 30000.    If DRDA allows it would be good
for the errorCode to be retained
> [C:/test] java -Dij.showErrorCode=true org.apache.derby.tools.ij
> ij version 10.3
> ij> connect 'jdbc:derby:wombat';
> ij> create table t(i nt, s smallint);
> ERROR 42X01: Syntax error: Encountered "" at line 1, column 18. (errorCode = 30000)
> ij> exit;
> [C:/test] ns start -noSecurityManager &
> [2]     5712
> [C:/test] Apache Derby Network Server - 10.3.0.0 alpha - (1) started and ready to accept
connections on port 1527 at 200
> 7-04-20 17:36:27.188 GMT
> [C:/test] java -Dij.showErrorCode=true org.apache.derby.tools.ij
> ij version 10.3
> ij> connect 'jdbc:derby://localhost:1527/wombat';
> ij> create table t(i nt, s smallint);
> ERROR 42X01: Syntax error: Encountered "" at line 1, column 18. (errorCode = -1)
> ij>
> Once this has been fixed ErrorCodeTest can be enabled for client.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message