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?
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();
}