Re: throw SQLException on no rs.next()?

From: rob <rob_mail(at)softhome(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: throw SQLException on no rs.next()?
Date: 2002-04-23 21:24:08
Message-ID: 3CC5D0F8.2070601@softhome.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Dave Cramer wrote:
> I thought I fixed it so that it doesn't throw an NPE, but I could be
> mistaken?
>
> Dave

You may have it's been a long time since I accidentally forgot to call
next().

> On Tue, 2002-04-23 at 08:09, Nick Fankhauser wrote:
>
>>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(at)postgresql(dot)org
>>>[mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of AgentM
>>>Sent: Tuesday, April 23, 2002 12:36 AM
>>>To: pgsql-jdbc(at)postgresql(dot)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(at)cmu(dot)edu
>>>
>>>---------------------------(end of broadcast)---------------------------
>>>TIP 6: Have you searched our list archives?
>>>
>>>http://archives.postgresql.org
>>>
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>>
>>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Sharon Cowling 2002-04-23 22:28:00 Help - is this a JDBC issue??
Previous Message Ryan Chambers 2002-04-23 21:09:54 Re: JDBC and transactions