code: boolean isAuthException(SQLException x) {
          return x instanceof SQLInvalidAuthorizationSpecException
                 || 1004 == x.getErrorCode() // default username feature not supported; logon denied
                 || 1005 == x.getErrorCode() // null password given; logon denied
                 || 1017 == x.getErrorCode(); // invalid username/password; logon denied
      }
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 an Oracle error code in (1004, 1005, 1017)
  
  @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.