List of utility methods to do SQLException
void | mergeSQLExceptionMsg(final StringBuilder msgBuilder, final SQLException e, final String prefix) merge SQL Exception Msg msgBuilder.append(prefix + "ErrorCode: "); msgBuilder.append(e.getErrorCode()); msgBuilder.append(", SQLState: "); msgBuilder.append(e.getSQLState()); msgBuilder.append(", Msg: "); String m = e.getMessage(); if (m != null) { msgBuilder.append(prefix + m.replaceAll("\n", "\n" + prefix)); ... |
boolean | oracleSessionHasBeenKilled(Exception exception) oracle Session Has Been Killed Throwable ex = exception; while (ex != null) { if (ex instanceof SQLException && ((SQLException) ex).getErrorCode() == 28) return true; ex = ex.getCause(); return false; |
SQLException | parseRemoteException(Throwable t) parse Remote Exception String message = t.getLocalizedMessage(); if (message != null) { Matcher matcher = PATTERN.matcher(t.getLocalizedMessage()); if (matcher.find()) { int errorCode = Integer.parseInt(matcher.group(1)); String sqlState = matcher.group(2); return new SQLException(matcher.group(), sqlState, errorCode, t); return null; |
void | printExceptionAndRollback(Connection conn, Exception e) print Exception And Rollback printException(e); try { if (conn != null) conn.rollback(); } catch (SQLException ignore) { |
void | printExceptions(OutputStream os, SQLException sqlEx) Print an exception, or series of exceptions to the designated output stream. PrintWriter pw = new PrintWriter(os, true); while (sqlEx != null) { pw.println("----------------------------------------------"); pw.println("ERROR CODE : " + sqlEx.getErrorCode()); pw.println("ERROR STATE: " + sqlEx.getSQLState()); sqlEx.printStackTrace(pw); sqlEx = sqlEx.getNextException(); |
void | printSQLException(SQLException e) print SQL Exception while (e != null) { System.err.println("\n----- SQLException -----"); System.err.println(" SQL State: " + e.getSQLState()); System.err.println(" Error Code: " + e.getErrorCode()); System.err.println(" Message: " + e.getMessage()); e = e.getNextException(); |
void | printSQLException(SQLException e) print SQL Exception String format = "%-12s : %s\n"; while (e != null) { String errMsg = "------------- SQLException ----------------\n"; errMsg += String.format(format, "SQL State", e.getSQLState()); errMsg += String.format(format, "Error Code", e.getErrorCode()); errMsg += String.format(format, "Cause", e.getCause()); errMsg += String.format(format, "Message", e.getMessage()); System.err.print(errMsg); ... |
void | printSQLException(SQLException ex) print SQL Exception for (Throwable e : ex) { if (e instanceof SQLException) { if (ignoreSQLException(((SQLException) e).getSQLState()) == false) { e.printStackTrace(System.err); System.err.println("SQLState: " + ((SQLException) e).getSQLState()); System.err.println("Error Code: " + ((SQLException) e).getErrorCode()); System.err.println("Message: " + e.getMessage()); Throwable t = ex.getCause(); ... |
void | printSQLException(SQLException ex) print SQL Exception for (Throwable e : ex) { if (e instanceof SQLException) { e.printStackTrace(System.err); System.err.println("SQLState: " + ((SQLException) e).getSQLState()); System.err.println("Error Code: " + ((SQLException) e).getErrorCode()); System.err.println("Message: " + e.getMessage()); Throwable t = ex.getCause(); while (t != null) { ... |
String | printSqlException(SQLException sqlex) print Sql Exception StringBuffer sb = new StringBuffer(); sb.append("SQLException:\n"); while (sqlex != null) { sb.append(sqlex.getMessage() + "\n"); sb.append("SQL State: " + sqlex.getSQLState() + "\n"); sb.append("Vendor Error Code: " + sqlex.getErrorCode() + "\n"); sqlex = sqlex.getNextException(); return sb.toString(); |