Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org Received: (qmail 72807 invoked from network); 28 May 2002 17:29:31 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 28 May 2002 17:29:31 -0000 Received: (qmail 20356 invoked by uid 97); 28 May 2002 17:29:26 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-dev@jakarta.apache.org Received: (qmail 20327 invoked by uid 97); 28 May 2002 17:29:25 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 20315 invoked by uid 98); 28 May 2002 17:29:25 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) X-Sent: 28 May 2002 17:29:22 GMT From: "James Mitchell" To: "Tomcat Developers List" Subject: RE: ResultSet Date: Tue, 28 May 2002 13:32:06 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <3CF3B6AD.C8D2DC5F@ts.es> X-Mimeole: Produced By Microsoft MimeOLE V5.00.2919.6700 Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N have you tried getting the row count from the db instead of looping yourself? this approach will offload a few resources (counting) back to the db (assuming its tiered) where it belongs(IMHO) //assuming your db supports count() [duh] //if you build your sql in chunks String sqlSelect = "Select Col1, Col2 " String sqlFrom = "From myTable " String sqlWhere = "Where Col3 = 'SomeVal'"; //typically a helper function //execute the sql on your connection Resultset rs = getMyResults("Select count(*) as ct " + sqlFrom + sqlWhere); size = rs.getLong("ct") //proceed as you did before, but this time you have the row count. Hope this helps. James Mitchell > -----Original Message----- > From: Manuel Rodriguez Diaz [mailto:mrodr@ts.es] > Sent: Tuesday, May 28, 2002 12:56 PM > To: tomcat-dev@jakarta.apache.org > Subject: ResultSet > > > > Hi all, > I'm working with java 1.1. (this is a mandatory requirement). > In this version of Java, resultset are "FORWARD ONLY". > The fact is that i need to count the rows contained in a resultset > before displaying its data and the way i've thought to do this is read > all the resultset. > rows= 0; > while( rs.next()) { > rows++; > } > > With my actual version of java, I would need to re-execute the query > again to get the pointer "beforeFirsted". > Is there any way to obtain a independent copy of a ResultSet without > executing the query again? > > Thankyou > > > -- > To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: