make the result set scroll insensitve, do rs.last(), get the row num, and call rs.beforeFirst(), then you can process the result set like you currently do.
String sql = "select * from testing";
PreparedStatement ps =
con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs = ps.executeQuery();
rs.last();
System.out.println("Row count = " + rs.getRow());
rs.beforeFirst();
~Tim
NOTE: Ugly, but does the trick.
> > > how to get number of rows return in SELECT query
> >
> > yah.
>
> I know you got the answer you were looking for from
> SomeoneElse; however, could you tell us why you need
> to know the number of rows before process - there
> might be a better way.
This is very good advice, and I almost included it in my post. I can think of very few, if any, circumstances where you would need to do this, which probably explains why there is not an rs.getRowCount() method.
~Tim