Search This Blog

Total Pageviews

How to find the number of rows in the resultset (CountResult)

public static int getRowCount(ResultSet set) throws SQLException
sqlString = "select * from country";
// Create a scrollable ResultSet.
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = stmt.executeQuery(sqlString);
// Point to the last row in resultset.
// Get the row position which is also the number of rows in the ResultSet.
int rowcount = rs.getRow();
// Reposition at the beginning of the ResultSet to take up rs.next() call.
return rowcount ;

No comments:

Windows 8.3 file naming setting is disabled for the product

To enable Windows 8.3 file naming setting use fsutil command Example:  c:\> fsutil 8dot3name set C: 0