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

Jørgen Løland commented on DERBY-1828:
--------------------------------------

I have two questions regarding this issue:

Q1) I need your opinion on whether or not this issue can be fixed before the 
next major release. I.e., may new error codes cause problems for existing 
applications?

Q2) Second, what would be the correct SQL states for the messages currently 
found under the "28" header in SQLState? My suggestions are:


***
Current in SQLState: AUTH_DATABASE_CONNECTION_REFUSED = "04501.C";

messages.properties reveals this:
-----8<------
04501.C=Database connection refused.
...
08004=Connection refused : {0}
08004.C.1=Connection authentication failure occurred.  Reason: {0}.
08004.C.2=The connection was refused because the database {0} was not found.
----->8------

Hence, it seems clear that 04501 is a variant of 08004, and should move 
accordingly. 08004 is "SQL-server rejected establishment of SQL-connection" 
according to SQL2003/SQL1999, which sounds reasonable.

***
Currently in SQLState:
AUTH_INVALID_USER_NAME                                      = "28502.C";
The message for this is "The user name '{0}' is not valid." Another case of 
08004? 

***
Current in SQLStates:
-----8<------
AUTH_INVALID_AUTHORIZATION_PROPERTY                         = "28501";
AUTH_USER_IN_READ_AND_WRITE_LISTS                           = "28503";
AUTH_DUPLICATE_USERS                                        = "28504";
AUTH_INTERNAL_BAD_UUID                                      = "28505";
----->8------ 
State 42? 


***
Current in SQLStates:
-----8<------
AUTH_NO_PERMISSION                                          = "28506";
AUTH_NO_PERMISSION_FOR_GRANT                                = "28507";
AUTH_NO_COLUMN_PERMISSION                                   = "28508";
AUTH_NO_COLUMN_PERMISSION_FOR_GRANT                         = "28509";
AUTH_NOT_OWNER                                              = "2850C";
AUTH_NO_ACCESS_NOT_OWNER                                    = "2850D";
AUTH_NOT_DATABASE_OWNER                                     = "2850E";
AUTH_GRANT_REVOKE_NOT_ALLOWED                               = "2850F";
----->8------ 
As already pointed out in this issue, these should move to '42' - syntax error 
or *access rule violation*. This is what patch (1) does.

***
Current in SQLStates:
-----8<------
AUTH_SHUTDOWN_NOT_DB_OWNER                                  = "2850H.C";
AUTH_ENCRYPT_NOT_DB_OWNER                                   = "2850I.C";
AUTH_HARD_UPGRADE_NOT_DB_OWNER                              = "2850J.C";
----->8------ 
May be either state '08' or '42'. They are violations of access rules (thrown 
when non-db owner tries to shutdown/encrypt/... the db), and therefore fit into 
state 42. However, the commands are requested through connect, and therefore 
also fit into 08 CONNECTION EXCEPTION. Since they are thrown at connect, I 
would suggest 08.

In addition there are some '25' error codes, but these are not discussed for 
now.

> Access rule violations should use a SQL state starting with '42' according to 
> the SQL standard.
> -----------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1828
>                 URL: https://issues.apache.org/jira/browse/DERBY-1828
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.2.1.6, 10.3.0.0
>            Reporter: Daniel John Debrunner
>         Assigned To: Jørgen Løland
>         Attachments: DERBY-1828-1.diff, DERBY-1828-1.stat
>
>
> The SQL standard says that SQL State '42' is for "syntax error or access
> rule violation" (section 23.1).
> There is a question of what JDBC 4.0 exception should be thrown for a access 
> rule violation,
> JDBC 4.0 maps '42' to SQLSyntaxErrorException which seems wrong for an access 
> rule.
> Message thread:
> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200609.mbox/[EMAIL 
> PROTECTED]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to