Code example for SQLException

Methods: getErrorCode, getMessage, getSQLState

0
                rs = stmt.getResultSet();
            } 
        } 
        catch (SQLException ex){
            // handle any errors 
            System.out.println("SQLException: " + ex.getMessage());
            System.out.println("SQLState: " + ex.getSQLState());
            System.out.println("VendorError: " + ex.getErrorCode());
        } finally { 
            return rs;
        } 
    } 
}