code: boolean isAuthException(SQLException x) {
          int ec = x.getErrorCode();
          return x instanceof SQLInvalidAuthorizationSpecException
                 || "28000".equals(x.getSQLState()) // Authorization name is invalid
                 || -1403 == ec // The username and/or password supplied is incorrect.
                 || -4214 == ec
                 || -30082 == ec // CONNECTION FAILED FOR SECURITY REASON
                 // [ibm][db2][jcc][t4][2013][11249] Connection authorization failure occurred.  Reason: User ID or Password invalid.
                 || x.getMessage() != null && x.getMessage().indexOf("[2013]") > 0;
      }
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 the 28000 SQLState (Invalid authorization specification)
  or a DB2 error code in (-1403, -4214, -30082)
  or an exception message containing the text [2013]
  
  @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.