Java SQLException printSQLException(SQLException e)

Here you can find the source of printSQLException(SQLException e)

Description

print SQL Exception

License

Open Source License

Declaration

public static void printSQLException(SQLException e) 

Method Source Code

//package com.java2s;
//    it under the terms of the GNU Affero General Public License as

import java.sql.SQLException;

public class Main {
    public static void printSQLException(SQLException e) {
        // Unwraps the entire exception chain to unveil the real cause of the
        // 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());
            // for stack traces, refer to derby.log or uncomment this:
            //e.printStackTrace(System.err);
            e = e.getNextException();/* w  w w . j  ava  2 s.c o  m*/
        }
    }
}

Related

  1. oracleSessionHasBeenKilled(Exception exception)
  2. parseRemoteException(Throwable t)
  3. printExceptionAndRollback(Connection conn, Exception e)
  4. printExceptions(OutputStream os, SQLException sqlEx)
  5. printSQLException(SQLException e)
  6. printSQLException(SQLException ex)
  7. printSQLException(SQLException ex)
  8. printSqlException(SQLException sqlex)
  9. printSQLExceptionToErrorLog(Log logger, String message, List sqlExceptions)