Here you can find the source of printSQLException(SQLException e)
public static void printSQLException(SQLException e)
//package com.java2s; /*//from w ww .ja v a 2s.c o m * This file is part of WaqtSalat-Service. * * WaqtSalat-Service is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * WaqtSalat-Service is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with WaqtSalat-Service. If not, see <http://www.gnu.org/licenses/>. */ import java.sql.SQLException; public class Main { public static void printSQLException(SQLException e) { 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); // for stack traces, refer to derby.log or uncomment this: // e.printStackTrace(System.err); System.err.println("--------------------------------------------\n"); e = e.getNextException(); } } }