Re: [JDBC] plpgsql function with RETURNS SETOF refcursor AS. How

From: Kris Jurka <books(at)ejurka(dot)com>
To: David Gagnon <dgagnon(at)siunik(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [JDBC] plpgsql function with RETURNS SETOF refcursor AS. How
Date: 2005-03-24 23:44:05
Message-ID: Pine.BSO.4.56.0503241840570.31387@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

On Thu, 24 Mar 2005, David Gagnon wrote:

> I'm already able to get Refcursor from a stored procedure. But now I
> need to get a SETOF refcursor and I can't make it work... Is that
> possible to do this via JDBC?
>
> He is the code I did. The rsTmp.next() throws a Connection is
> closed. Operation is not permitted. Exception.
>
>
> rs = new ResultSet[j];
> System.arraycopy(tempArray, 0, rs, 0, j);
> rsTmp.close();

System.arraycopy does not make a deep copy, so the rsTmp.close() closes
the ResultSet. You really can't copy resources around like that.
Consider how you would copy a Connection object. Does that establish a
new connection? The underlying tcp/ip connection can't be copied.

Kris Jurka

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2005-03-24 23:58:10 Re: plperl doesn't release memory
Previous Message David Gagnon 2005-03-24 23:30:17 plpgsql function with RETURNS SETOF refcursor AS. How to get it work via JDBC

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2005-03-24 23:45:28 Re: [Patch] JDBC3 Blob support
Previous Message Kris Jurka 2005-03-24 23:40:33 Re: Unable to make a connention through jdbc