0

I am using the following query :

ResultSet resultset = prepraparedStatement.executeQuery();
int rowCount = resultSet.getFetchSize();

Does this work for getting the row count from a particular table?

Casey West
  • 578
  • 5
  • 22
Tapajyoti Giri
  • 39
  • 2
  • 2
  • 13

1 Answers1

0

ResultSet.getFetchSize() doesn't return the number of results. JDBC 2.0 also allows you to specify the number of rows fetched with each database round trip for a query, and this number is referred to as the fetch size. You can read about it here

And about getting number of rows in result set you can try

int size= 0;  
if (resultSet!= null)   
{  
  resultSet.beforeFirst();  
  resultSet.last();  
  size = resultSet.getRow();  
}
Muhammad Usman
  • 10,039
  • 22
  • 39