Does 'N/A' in JDBC 4.0 spec(Table 6.1) mean Derby is free to choose the the SQL State number? If so, then I think we shold definitely use '42' for access rule violation since that will satisfy SQL specification too.
 
Also it seems for access rule violation, SQLInvalidAuthorizationException would be the correct exception to throw. I think there is a trick to use same SQL state for 2 different exceptions in Derby code, but I can't recall how to do it.

Mamta
 
On 9/7/06, Yip Ng <[EMAIL PROTECTED]> wrote:
For Q1)  I think it should use SQLSTATE class code of '42' instead of '28'. 
class code '42' is used for syntax error or access rule violation according to the
SQL spec.
 

Yip


On 9/7/06, Daniel John Debrunner <[EMAIL PROTECTED] > wrote:
The SQL standard says that SQL State '42' is for "syntax error or access
rule violation" (section 23.1).

JDBC 4.0 states in section 6.5.1 that "TABLE 6-1 specifies which
NonTransientSQLException subclass must be thrown
for a a given SQLState class value:" and Table 6.1 has these two lines
of interest:

SQL State 42 ->> SQLSyntaxErrorException.
SQL State 'N/A' ->> SQLInvalidAuthorizationException


Derby currently uses SQL State '28' for access rule violations, the SQL
standard says that's for 'invalid authorization specification' and only
used in statements not supported by Derby.


So:

Q1) Should Derby be using '42' for access rule violations?

Q2) If Derby uses '42' for access rule violations should it throw a
SQLSyntaxErrorException, a NonTransientSQLException, a SQLException or
SQLInvalidAuthorizationException?

Dan.





Reply via email to