After executing a Statement which returns a ResultSet, is there any method to call or a way to determine how many rows are contained in the ResultSet without looping through the ResultSet?
I would like to know how many rows are returned prior to processing the ResultSet. TIA
Anil Vupputuri
Ranch Hand
Joined: Oct 31, 2000
Posts: 527
posted
0
Hai, JDBC1.2 API doesnt have this functionality ,where from JDBC2.0 it provides all userfriendly methods which u can access size of the resultset.For JDBC2.0API ,JDBC-ODBC bridge wont support so go for pure Java drivers i.e., thin drivers for Oracle.
SCJP 1.5, SCEA, ICED (287,484,486)
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
Since the ResultSet doesn't actually contain all the rows (imagine doing a select * on a table with 100 million rows) but goes back to the database to get more rows as needed, I don't believe that the ResultSet has any way of knowing the actual size of the ResultSet. Anil, is there a particular method you had in mind?
there is no way to get total row count from resultset. but what u can do to get total no of rows returned, run a sql query before it to get count of your query. i hope this will solve ur pb.