/**
 * Get the number of rows of the ResultSet object.
 * @param rs the ResultSet object
 * @return the number of rows of the ResultSet object
 */
public static int sqlResultSetLength(java.sql.ResultSet rs) {
	int length = 0;
	try {
		rs.last();
		length = rs.getRow();
		rs.beforeFirst();
	} catch (java.sql.SQLException ex) {
		Ts.printErr(ex);
	}
	return length;
}
 
public static void printErr(java.sql.SQLException ex) {
	System.out.println("SQL State: " + ex.getSQLState());
	System.out.println("Error Code: " + ex.getErrorCode());
	Ts.printErr((java.lang.Exception) ex);
}
 
public static void printErr(java.lang.Exception ex) {
	ex.printStackTrace();
	System.exit(-1);
}


Back to JavaHowTo

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang