Skip site navigation (1) Skip section navigation (2)

unusual ResultSet.next() behaviour

From: "Les Carter" <carterl(at)newkinetics(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: unusual ResultSet.next() behaviour
Date: 2005-07-27 05:00:25
Message-ID: 1122440425.20140@workhorse.newkinetics.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
This is a multi-part message in MIME format.

--bound1122440425
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Consider the following code snippet where rs is a ResultSet object obtained from a previous query:<br /><br />    for(int count=0; count!=someValue; count++)<br />    {<br />        if(!rs.next()) throw SomeException();<br />    }<br />    rs.next();<br /><br />Pretty simple, just cycle through someValue number of records and then get the next record after that.  For some reason, say if the query has 20 rows that will be returned, and I set someValue to be 5 for arguments sake, it will go through the for loop with no problems, but when it comes out of the for loop and tries to the next rs.next() operation it always returns false.  I can increase someValue to 10 and it will still loop without a problem, but it will always return false for that rs.next() operation following the for loop.<br /><br />I can't see any rational reason for this.  I'm using PostgreSQL 8.0 and the JDBC 3 drivers on Win XP with JDK 1.42_06.  The ResultS!
 et is a proxy object gained from a JBoss4.0 supplied connection pool.<br /><br />Can anyone offer any explanation, or repeat the simple steps to confirm I'm not loosing my sanity?<br /><br />Cheers,<br /><br />L<br />

--bound1122440425--



Attachment: unknown_filename
Description: text/html (1.3 KB)

Responses

pgsql-jdbc by date

Next:From: Michael AllmanDate: 2005-07-27 05:09:46
Subject: Re: jdbc xa patches
Previous:From: Oliver JowettDate: 2005-07-27 04:35:10
Subject: Re: jdbc xa patches

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group