errCode);
} else if (sqlState.startsWith(SQLState.AUTHORIZATION_SPEC_PREFIX)) {
ex = new SQLInvalidAuthorizationSpecException(message, sqlState,
errCode);
} else if (sqlState.startsWith(SQLState.TRANSACTION_PREFIX)) {
ex = new SQLTransactionRollbackException(message, sqlState,
errCode);
} else if (sqlState.startsWith(SQLState.LSE_COMPILATION_PREFIX)) {
ex = new SQLSyntaxErrorException(message, sqlState, errCode);
} else if (
sqlState.startsWith (SQLState.UNSUPPORTED_PREFIX) ||
sqlState.equals(DRDA_COMMAND_NOT_SUPPORTED) ||
sqlState.equals(DRDA_OBJECT_NOT_SUPPORTED) ||
sqlState.equals(DRDA_PARAM_NOT_SUPPORTED) ||
sqlState.equals(DRDA_VALUE_NOT_SUPPORTED) ||
sqlState.equals(DRDA_SQLTYPE_NOT_SUPPORTED) ||
sqlState.equals(DRDA_REPLY_MSG_NOT_SUPPORTED) ) {
ex = new SQLFeatureNotSupportedException(message, sqlState,
errCode);
} else if
(
sqlState.equals(SQLState.LANG_STATEMENT_CANCELLED_OR_TIMED_OUT.substring(0, 5)) ||
sqlState.equals(SQLState.LOGIN_TIMEOUT.substring(0, 5))
) {
ex = new SQLTimeoutException(message, sqlState, errCode);
}
// If the sub-class cannot be determined based on the SQLState, use
// the severity instead.
else if (errCode >= ExceptionSeverity.SESSION_SEVERITY) {
ex = new SQLNonTransientConnectionException(
message, sqlState, errCode);
} else if (errCode >= ExceptionSeverity.TRANSACTION_SEVERITY) {
ex = new SQLTransactionRollbackException(
message, sqlState, errCode);
}
// If none of the above fit, return a plain SQLException.
else {
ex = new SQLException(message, sqlState, errCode);