Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
rs.afterLast() ;
rs.previous();
int number = rs.getRow();
----------------------------------------------------------------------
number 是你要的记录数