View RSS Feed

Java Database

  1. Retrieving Exceptions

    by , 03-10-2012 at 08:58 AM
    The given code outputs the following that is contained in the SQLException or other exception which have been chained to it:
    • SQL State
    • Error description
    • Error Code
    • Cause

    Java Code:
    public static void
        printSQLException(SQLException ex) {
        for (Throwable e : ex) {
            if (e instanceof SQLException) {
                if (ignoreSQLException(
                    getSQLState()) == false)