Code example for ResultSet

Methods: getLong, next

0
		long numRecords = -1;
		try 
		{ 
			stmt = _conn.prepareStatement(sql);
			rs = stmt.executeQuery();
			if (rs.next())
			{ 
				numRecords = rs.getLong(1);
			} 
		} catch ( SQLException sqlEx) {
		    LOG.error("getNumRecords() error: " + sqlEx.getMessage(), sqlEx);
		} finally { 
			DBHelper.close(rs,stmt,null);
		} 
		return numRecords;
	} 
 
  /** 
   * 
   * @param from : Defines lower bound of srckey  (> from) 
   * @return resultSet: consists of rows sorted in ascending order of srckey