db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: SQL state 42, access permissions, SQL standard and JDBC 4.0
Date Thu, 07 Sep 2006 20:37:30 GMT
Mamta Satoor <msatoor@gmail.com> 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

Mime
View raw message