Here you can find the source of printSQLException(SQLException e)
public static void printSQLException(SQLException e)
//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*/ } } }