Code example for SQLException

Methods: getMessagegetErrorCodegetSQLState

0
 * @version $Revision$ 
 */ 
public class SQLExceptionReader implements ExceptionReader { 
     public String getMessage(Throwable t) {
        SQLException e = (SQLException)t;
        return e.getMessage() + "(SQL Code: " + e.getErrorCode() + ", SQL State: + " + e.getSQLState() + ")";
    } 
 
    public Throwable getCause(Throwable t) {
        SQLException e = (SQLException)t;
        Throwable cause = e.getNextException();
        if(cause==null) {
            cause = e.getCause();
        } 
        return cause;
    } 
 
    public Class getExceptionType() {
        return SQLException.class;
    } 
Contextual code suggestions in your IDE  Get Codota for Java