Originally posted by sree lekha:
..i need to find if my resultSet has got records or not.
Sreelekha,
As krishnamoorthy said, you can check the next() method of resultset object which gets you inside if the resultset stores some rows fetched out of the query execution.
The resultset object works in a way that it has got a pointer before the very first row of the results fetched. Whenever you want to start iterating (looping it over), you have to invoke the next() on the resultset object, which intern increments the pointer to point to the next row. For the first time, it would point to the very first-and-beginning row.
Once all the rows are iterated (processed) (means,when the pointer is in last row), the next() method returns false as there are NO more rows to process.
..how do i find the size of my resultSet after the query is executed.
What exactly do you mean the size of resultset? Did you mean to ask the number of rows or columns(count) the resultset contains? If that case, there is no direct method provided for the same. But indirectly you can use something called
ResultSetMetaData which has a method
getColumnCount().