Quantcast
Channel: S. Nageswara Rao, Corporate Trainer – Way2Java
Viewing all articles
Browse latest Browse all 505

How to find number of rows in the ResultSet object?

$
0
0
There is no direct method in JDBC. In JDBC 1.0, the only way available is using while loop with a counter as follows. 1 2 3 4 5 6 7 8 ResultSet res = stmt.executeQuery("select * from Employee");   int counter = 0; while(res.next()) { counter++; } System.out.println("Number of records in ResultSet: " + counter); […]

Viewing all articles
Browse latest Browse all 505

Trending Articles