Mamta Satoor <[EMAIL PROTECTED]> writes:

> 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 the last sentence is missing a not. I found this description at
http://download.java.net/jdk6/docs/api/java/sql/SQLInvalidAuthorizationSpecException.html:

  The subclass of SQLException thrown when the SQLState class value is
  '28'. This indicated that the authorization credentials presented
  during connection establishment are not valid.

Sounds like a different kind of access violation.

> 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.

You can separate between them with a suffix. From SQLState.java:

    String NOT_IMPLEMENTED = "0A000.S";
    String JDBC_METHOD_NOT_IMPLEMENTED = "0A000.S.1";
    String JDBC_METHOD_NOT_SUPPORTED_BY_SERVER = "0A000.S.2";
    (...)

-- 
Knut Anders

Reply via email to