Reputation: 10953
How getFetchSize()
and next()
methods of ResultSet are not giving the same result?, as you can see a getFetchSize comes as 7 but while loop contents are not printing.
ResultSet resultSet = (ResultSet) callableStatement.getObject(7);
System.out.println("resultSet::::::::::::::getFetchSize::>>>>>" + resultSet.getFetchSize());
int i = 1;
while (resultSet.next())
{
System.out.println("inside while loop:" + i);
}
System.out.println("finished");
Output:
resultSet::::::::::::::getFetchSize::>>>>> 10
finished
Upvotes: 0
Views: 445
Reputation: 36987
getFetchSize()
doesn't tell you how large the resultset is - this information is generally not known in advance - but the size of the internal buffer that is used to fetch the results. In this case, the JDBC driver would fetch 10 result rows at once, delivering them one-by-one when you call next()
.
Obviously, that doesn't mean there will really be 10 results.
Upvotes: 4