public static void logWarnings(SQLWarning warning) { logWarnings(warning, null); }
public static void logAndClearWarnings(Connection connection) { if ( log.isWarnEnabled() ) { try { logWarnings( connection.getWarnings() ); connection.clearWarnings(); } catch (SQLException sqle) { //workaround for WebLogic log.debug("could not log warnings", sqle); } } }
public static void logAndClearWarnings(Connection connection) { if ( log.isWarnEnabled() ) { try { logWarnings( connection.getWarnings() ); } catch (SQLException sqle) { //workaround for WebLogic log.debug("could not log warnings", sqle); } } try { //Sybase fail if we don't do that, sigh... connection.clearWarnings(); } catch (SQLException sqle) { log.debug("could not clear warnings", sqle); } }
public static void logWarnings(SQLWarning warning, String message) { if ( log.isWarnEnabled() ) { if ( log.isDebugEnabled() && warning != null ) { message = StringHelper.isNotEmpty(message) ? message : DEFAULT_WARNING_MSG; log.debug( message, warning ); } while (warning != null) { StringBuffer buf = new StringBuffer(30) .append( "SQL Warning: ") .append( warning.getErrorCode() ) .append( ", SQLState: ") .append( warning.getSQLState() ); log.warn( buf.toString() ); log.warn( warning.getMessage() ); warning = warning.getNextWarning(); } } }
private void execute(String sql, Statement statement) { try { statement.executeUpdate(sql); SQLWarning warning = statement.getWarnings(); if (warning != null) { JDBCExceptionReporter.logWarnings(warning); statement.clearWarnings(); } } catch (SQLException e) { JDBCExceptionReporter.logExceptions(e, "failed to execute update"); exceptions.add(e); } }