code: boolean isAuthException(SQLException x)
      {
          return x instanceof SQLInvalidAuthorizationSpecException
                 || "JZ00L".equals(x.getSQLState()) // Login failed. Examine the SQLWarnings chained to this exception for the reason(s).
                 || "JZ001".equals(x.getSQLState()) // User name property '_____' too long. Maximum length is 30.
                 || "JZ002".equals(x.getSQLState()); // Password property '_____' too long. Maximum length is 30.
      }
docs: Determine if the top level exception is an authorization exception.
  Chained exceptions are not checked.
  
  Look for the JDBC 4.0 exception subclass
  or a Sybase SQLState in (JZ00L, JZ001, JZ002)
  
  @param x the exception to check.
  @return true or false to indicate if the exception is an authorization error.
  @throws NullPointerException if a NULL exception parameter is supplied.