Back
You can use any one of the following methods:
SELECT COUNT(*) FROM ... query instead.
OR
int size =0;if (rs != null) { rs.last(); // moves cursor to the last row size = rs.getRow(); // get row id }
int size =0;
if (rs != null)
{
rs.last(); // moves cursor to the last row
size = rs.getRow(); // get row id
}
In both cases, you don't have to loop over the entire data.
If you want to learn Java, then enroll in this Java Certification Program by Intellipaat.
31k questions
32.8k answers
501 comments
693 users