List of utility methods to do SQLException
boolean | isReadOnlyException(SQLException e) is Read Only Exception return e.getErrorCode() == READ_ONLY_ERROR_CODE && e.getMessage().contains(READ_ONLY_ERROR_MESSAGE);
|
boolean | isRecoverableException(SQLException e) is Recoverable Exception String sqlState = e.getSQLState(); if (sqlState != null && (sqlState.equals(SQL_STATE_DEADLOCK) || sqlState.equals(SQL_STATE_TIMEOUT) || sqlState.equals(SQL_STATE_IOERROR) || sqlState.equals(SQL_STATE_UNKNOWN))) { return true; SQLException nextException = e.getNextException(); if (nextException != null && nextException != e) { return isRecoverableException(nextException); ... |
boolean | isTransient(SQLException e) is Transient return false;
|
boolean | isXJ015Error(Throwable exception) is XJ Error while (exception != null) { if (exception instanceof SQLException && "XJ015".equals(((SQLException) exception).getSQLState())) { return true; exception = exception != exception.getCause() ? exception.getCause() : null; return false; |
void | log(Logger logger, SQLException e) Logback does not log exceptions associated to java.sql.SQLException#getNextException() . SQLException next = e.getNextException(); while (next != null) { logger.error("SQL error: {}. Message: {}", next.getSQLState(), next.getMessage()); next = next.getNextException(); |
void | log(SQLException e, Logger log) log while (e != null) {
log.debug(e.getMessage(), e);
e = e.getNextException();
|
void | logAll(Log log, SQLException e) Log entire chain of SQLExceptions using old SQLException.getNextException interface instead of new Throwable.getCause(). logAll(log, null, e); |
void | logSqlError(SQLException ex, Logger logger) log Sql Error System.out.printf("DBERROR OCCURS: \n CODE-%d\n STATE: %s MESSAGE: %s", +ex.getErrorCode(),
ex.getSQLState(), ex.getMessage());
|
SQLException | mergeException(List merge Exception SQLException first = exceptions.get(0); List<StackTraceElement> stes = new ArrayList<StackTraceElement>(30 * exceptions.size()); for (StackTraceElement ste : first.getStackTrace()) { stes.add(ste); Set<SQLException> exceptionsSet = new HashSet<SQLException>(exceptions.size()); exceptionsSet.add(first); for (int i = 1, n = exceptions.size(); i < n; i++) { ... |
SQLException | mergeException(List merge Exception SQLException first = exceptions.get(0); List<StackTraceElement> stes = new ArrayList<StackTraceElement>(30 * exceptions.size()); boolean hasSplit = false; for (StackTraceElement ste : first.getStackTrace()) { stes.add(ste); if (ste == split) { hasSplit = true; if (!hasSplit) { stes.add(split); SQLException current = null; for (int i = 1, n = exceptions.size(); i < n; i++) { current = exceptions.get(i); hasSplit = false; for (StackTraceElement ste : current.getStackTrace()) { stes.add(ste); if (ste == split) { hasSplit = true; if (!hasSplit) { stes.add(split); first.setStackTrace(stes.toArray(new StackTraceElement[stes.size()])); return first; |