Home > Archive > PostgreSQL JDBC > July 2005 > Re: unusual ResultSet.next() behaviour









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: unusual ResultSet.next() behaviour
Jan de Visser

2005-07-27, 9:24 am

First off, you need a different e-mail client. The one you're using makes a
royal mess of MIME messages. Please stop using it (at least don't use it to
send to this list :)


On Wednesday 27 July 2005 01:00, Les Carter wrote:
> Consider the following code snippet where rs is a ResultSet object obtained
> from a previous query:
>
> ___ for(int count=0; count!=someValue; count++)
> ___ {
> _______ if(!rs.next()) throw SomeException();
> ___ }
> ___ rs.next();
>
> 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.
>
> 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.
>
> Can anyone offer any explanation, or repeat the simple steps to confirm I'm
> not loosing my sanity?


Works for me. I don't see what you're experiencing; my next() after the loop
returns true.

>
> Cheers,
>
> L


JdV!!

--
--------------------------------------------------------------
Jan de Visser _ _ _ _ _ _ _ _ _ _ jdevisser@digitalfai
rway.com

_ _ _ _ _ _ _ _ Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com