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

Re: first() causes NullPointerException

From: Kris Jurka <books(at)ejurka(dot)com>
To: Nico <nicohmail-postgresql(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: first() causes NullPointerException
Date: 2004-12-23 10:30:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

On Thu, 23 Dec 2004, Nico wrote:

> I have a servlet that extracts data from a postgresql database and makes a
> nice menu of it. The connection works fine, I can execute my sql-statement
> without any problems, but when I try the first() method of ResultSet it
> fails: it throws a NullPointerException at line 216.
>             resultsetL1=getQuery("SELECT * FROM \"qryMenuL1\" ORDER BY "+
>                 "\"MenuL1Order\"");
>             resultsetL1C=getQuery("SELECT COUNT(\"MenuL1ID\") FROM
> \"qryMenuL1\"");

According to the JDBC spec you are only allowed to have one ResultSet open 
per Statement.  When you create the second ResultSet the first is 
automatically closed.  This causes the NPE or in the CVS version of the 
driver an error message indicating that the result is already closed.

Kris Jurka

In response to


pgsql-jdbc by date

Next:From: NicoDate: 2004-12-23 11:06:36
Subject: Re: first() causes NullPointerException
Previous:From: NicoDate: 2004-12-23 09:58:02
Subject: first() causes NullPointerException

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