Re: throw SQLException on no rs.next()? - Mailing list pgsql-jdbc

From Nick Fankhauser
Subject Re: throw SQLException on no rs.next()?
Date
Msg-id NEBBLAAHGLEEPCGOBHDGGEFDENAA.nickf@ontko.com
Whole thread Raw
In response to throw SQLException on no rs.next()?  (AgentM <agentm@cmu.edu>)
Responses Re: throw SQLException on no rs.next()?  (Dave Cramer <Dave@micro-automation.net>)
List pgsql-jdbc
Yes, it sure does. The way I usually handle stepping through a ResultSet is
with a structure like this:

/* create REsultSet results */
while (results.next())
{
  /*do something with results*/
}

You're right about this being a common newbie gotcha. I'll add it to the
newbie FAQ.

-NF


> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of AgentM
> Sent: Tuesday, April 23, 2002 12:36 AM
> To: pgsql-jdbc@postgresql.org
> Subject: [JDBC] throw SQLException on no rs.next()?
>
>
> Hi- it's me the JDBC newbie again and I have a simple request. Could
> a call to resultset.getX() throw some exception if rs.next() has not
> yet been called? I just got horribly burned by missing this simple
> thing and I think it may be helpful to other newbies to have this
> extra bit of information. Thanks.
> --
> ><><><><><><><><><><><><
> AgentM
> agentm@cmu.edu
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>


pgsql-jdbc by date:

Previous
From: rob
Date:
Subject: Re: throw SQLException on no rs.next()?
Next
From: Dave Cramer
Date:
Subject: Re: throw SQLException on no rs.next()?