/** * Returns all error messages by following the exception chain. * @param exception * @return */ public String getExceptionChainMessage(SQLException exception) { if (exception != null) { StringBuffer sb = new StringBuffer(exception.getMessage()).append(LINE_SEPARATOR); if (exception.getNextException() != null && exception.getNextException() != exception) { sb.append(getExceptionChainMessage(exception.getNextException())); } return sb.toString(); } return null; } }