Code example for ResultSet

Methods: getLong, next

0
	  try 
	  { 
		  stmt = conn.createStatement();
		  rs = stmt.executeQuery(query);
 
		  if ( rs.next() )
		  { 
			  res = rs.getLong(1);
		  } 
	  } finally { 
		  DBHelper.close(rs,stmt,null);
	  } 
	  return res;
  } 
 
 
  /** 
   * 
   * @param query: that expects to return a single long 
   * @param defaultVal: value to be returned if there is an error in query or if a null result was found 
   * @param timeoutSeconds : query timeout