没有,你可以用next()来取数目。
public int getMount(Resultset re)
if(re != null)
{
    int i = 0;
    while(re.next())
          i++;
    return i;
}
else return 0;//or throw a Exception here
}

解决方案 »

  1.   

    多种方法,楼上的方法比较笨而且速度慢,不过比较通用不需要JDBC支持,如下:
    1.用sql语句获得
    rs.executeQuery("select count(*) from tablename");
    rs.next();
    int rsCount=rs.getInt(1);
    2.用last和getRows方法,如下:
    rs.executeQuery("select * from tablename");
    rs.last();
    int rsCount=rs.getRow();
    rs.beforeFirst();
      

  2.   

    select count(*) from tablename 使得数据库不得不读取整个表所有字段,用select count(1) from tablename就不会了,更好更快!
      

  3.   

    我试过了rs.last() 本质上是不是和用while循环一样?都很慢,记录数很多的情况。