Re: ResultSet got NullPointerException on getMetaData calls

Lists: pgsql-jdbc
From: "Gaetano Sferra" <gaesferr(at)libero(dot)it>
To: "pgsql-jdbc" <pgsql-jdbc(at)postgresql(dot)org>
Subject: ResultSet got NullPointerException on getMetaData calls
Date: 2004-12-06 08:40:41
Message-ID: I8ALFT$189578CB5BD118C282FC0B9D1E04A48E@libero.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hello to all,
I got a NullPointerException when try to call getMetaData method on a refcursor
mapped on a ResultSet.
This is an example scenario:

create table mytable(name varchar, surname varchar, email varchar);
create or replace function myfunction() returns refcursor as'
declare
rc refcursor;
begin
open rc for select * from mytable order by surname;
return rc;
end;

This is a piece of code using the above stored function:

conn.setAutoCommit(false);
CallableStatement proc = conn.prepareCall("{ ? = call myfunction() }");
proc.registerOutParameter(1, Types.OTHER);
proc.execute();
ResultSet rs = (ResultSet) proc.getObject(1);
ResultSetMetaData rsmd = rs.getMetaData(); // <- NullPointerException

I'm using the PostgreSQL 7.4 server and the PostgreSQL JDBC 7.4 drivers.
Reading a previous post by Tomas on this ML I've tried to use the PostgreSQL
JDBC 8.0 driver without succes, the exception stills here.

Thank you for support,
Gaetano Sferra

____________________________________________________________
Libero ADSL: 3 mesi gratis e navighi a 1.2 Mega, senza costi di attivazione.
Abbonati subito su http://www.libero.it


From: Kris Jurka <books(at)ejurka(dot)com>
To: Gaetano Sferra <gaesferr(at)libero(dot)it>
Cc: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: ResultSet got NullPointerException on getMetaData calls
Date: 2004-12-06 09:10:18
Message-ID: Pine.BSO.4.56.0412060404540.4347@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Mon, 6 Dec 2004, Gaetano Sferra wrote:

> I got a NullPointerException when try to call getMetaData method on a
> refcursor mapped on a ResultSet.

ResultSets based on refcursors currently don't have any metadata
associated with them. The whole refcursor implementation could be
upgraded to really use the V3 protocol (which would also allow it to
respect setFetchSize), but no one has tackled this project, so you are
unfortunately out of luck at the moment.

Kris Jurka


From: Kris Jurka <books(at)ejurka(dot)com>
To: Gaetano Sferra <gaesferr(at)libero(dot)it>
Cc: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: ResultSet got NullPointerException on getMetaData calls
Date: 2005-01-30 11:08:38
Message-ID: Pine.BSO.4.56.0501300528290.1119@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Mon, 6 Dec 2004, Kris Jurka wrote:

> ResultSets based on refcursors currently don't have any metadata
> associated with them. The whole refcursor implementation could be
> upgraded to really use the V3 protocol (which would also allow it to
> respect setFetchSize), but no one has tackled this project, so you are
> unfortunately out of luck at the moment.
>

Actually, rechecking this report. Things seem to work fine in the 8.0
driver and ResultSetMetaData is available for refcursor ResultSets. The
fetchsize is still an open item though.

Kris Jurka