Re: NullPointerException when calling ResultSet.absolute(int)

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: NullPointerException when calling ResultSet.absolute(int)
Дата
Msg-id 43122F3E.3040002@opencloud.com
обсуждение исходный текст
Ответ на NullPointerException when calling ResultSet.absolute(int)  (Clemens Eisserer <linuxhippy@gmail.com>)
Ответы Re: NullPointerException when calling ResultSet.absolute(int)
Список pgsql-jdbc
Clemens Eisserer wrote:

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

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.

-O

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: David Gagnon
Дата:
Сообщение: Re: implementing asynchronous notifications PLEASE CONFIRM MY
Следующее
От: "Arcadius A."
Дата:
Сообщение: Re: implementing asynchronous notifications PLEASE CONFIRM MY