Re: NullPointerException inside ResultSet.next()

From: "Dave Cramer" <Dave(at)micro-automation(dot)net>
To: "'Graham Leggett'" <minfrin(at)sharp(dot)fm>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: NullPointerException inside ResultSet.next()
Date: 2002-02-18 00:00:40
Message-ID: 01c001c1b80f$4d91b720$8201a8c0@inspiron
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Graham,

It appears you have two result sets open? One for the
recipes.getInt("recipe_index")

Can we see the rest of the code around this?

Dave

-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of Graham Leggett
Sent: Sunday, February 17, 2002 6:45 PM
To: pgsql-jdbc(at)postgresql(dot)org
Subject: [JDBC] NullPointerException inside ResultSet.next()

Hi all,

I have a query which returns multiple rows like so:

ResultSet ingredients = st.executeQuery("SELECT * FROM ingredientslookup
WHERE (recipeindex = " + recipes.getInt("recipe_index") + ")");

while (ingredients.next()) {
// do stuff
}

When I run this query, it iterates through the while loop exactly once,
but then bombs out on the second attempt to evaluate
"ingedients.next()".

java.lang.NullPointerException
at org.postgresql.jdbc2.ResultSet.next(ResultSet.java:113)

My question is: Should it be possible for this exception to occur inside
this code at all?

Am I making a mistake somewhere, or is this a bug in the jdbc driver?

I have tried both the driver that came with v7.1.3, and the latest v7.2
driver from jdbc.postgresql.org.

Regards,
Graham
--
-----------------------------------------
minfrin(at)sharp(dot)fm "There's a moon
over Bourbon Street
tonight..."

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Graham Leggett 2002-02-18 03:11:09 Re: NullPointerException inside ResultSet.next()
Previous Message Graham Leggett 2002-02-17 23:44:37 NullPointerException inside ResultSet.next()