I am looking at a code written way back in time. It looks like this
public String MaxID() throws SQLException {
    Connection conn = null;
    Statement stmt = null;
    ResultSet rset = null;
    try {
    DriverManager.registerDriver(new org.gjt.mm.mysql.Driver());
    conn = DriverManager.getConnection(get_db_url(), get_db_id(), get_db_pw());
    stmt = conn.createStatement();
    String sql = null;
    sql = "select MAX(id)+1 AS count from tbl1";
    rset = stmt.executeQuery (sql);
    rset.next();         
    String newId = rset.getString("count");
    if (newId == null)
        newId = "1";     
        return newId;
    } catch (SQLException e) {
        return ("<P> SQL error: <PRE> " + e + " </PRE> </P>\n");
    } finally {
        if (rset!= null) rset.close();
        if (stmt!= null) stmt.close();
        if (conn!= null) conn.close();
    }
}
When I try to run it I receive the following output:
An error occurred at line: 146 in the jsp file: /functions.jsp Unhandled exception type SQLException 143: ResultSet rset = null; 144: 145: 146: DriverManager.registerDriver(new org.gjt.mm.mysql.Driver()); 147: conn = DriverManager.getConnection(get_db_url(), get_db_id(), get_db_pw()); 148: stmt = conn.createStatement(); 149: String sql = null;
And I can not understand why. It sems to be handled in a proper way (according to what I have read in the docs)
 
    