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

Re: NullPointerException when calling ResultSet.absolute(int)

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Clemens Eisserer <linuxhippy(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: NullPointerException when calling ResultSet.absolute(int)
Date: 2005-08-28 21:40:14
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Clemens Eisserer wrote:

> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> 	at org.postgresql.jdbc2.AbstractJdbc2ResultSet.absolute(
> 	at CATableModel.getValueAt(
> 	at javax.swing.JTable.getValueAt(

From your later email this was because the ResultSet was closed. FWIW,
more recent drivers should throw an appropriate SQLException in this
case, instead of NPE.

> btw. is there a more intelligent way to find out how many lines have
> been selected than starting two queries where the one query just
> queries the row-count?
> I did not find any better solution, but for complex queries this is
> really inefficient :-(

Either you can use two queries, or use a scrollable ResultSet and call
ResultSet.last() / ResultSet.getRow(). The second approach causes the
entire ResultSet to be loaded into the Java heap, though, so it's not so
good for large results.


In response to


pgsql-jdbc by date

Next:From: Peter WilkinsDate: 2005-08-29 00:23:08
Subject: username and password for postgresql jdbc FTP site
Previous:From: David GagnonDate: 2005-08-28 19:51:53
Subject: Re: implementing asynchronous notifications PLEASE CONFIRM MY

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