handling refcursors

From: Stuart Robinson <stuart(at)zapata(dot)org>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: handling refcursors
Date: 2002-07-02 07:52:33
Message-ID: Pine.LNX.4.44.0207020044380.25867-100000@www.dreamingamerica.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I'm trying to use a function that returns a refcursor in a web
application.

I followed the example code I found at this URL (as suggested on this
mailing list):

http://fts.postgresql.org/db/mw/msg.html?mid=1354157.

I wound up writing this code inside of my base factory class:

System.out.println("-- SQL: " + stmt);
ps = con.prepareStatement(stmt);
ps = bindSelectStmt(ps, obj, selectCase);
ResultSet rs = ps.executeQuery();
rs.next();
String cursorName = rs.getString(1);
System.out.println("-- CURSOR NAME: " + cursorName);
rs = ps.executeQuery("fetch all from " + cursorName);

But when I try running that, I get the following output from
Tomcat:

-- SQL: SELECT get_examples_by_entry_id(?)
-- CURSOR NAME: <unnamed cursor 1>
java.sql.SQLException: ERROR: parser: parse error at or near "<"

I believe the exception is caused by the cursor name, which I know from
the system-out to be:

<unnamed cursor 1>

Any ideas as to what's going on here?

Thanks in advance.

Regards,
Stuart

--
Stuart P. Robinson [stuart(at)zapata(dot)org]
688 Hampshire Street
San Francisco, CA 94110
USA

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message tony 2002-07-02 08:06:02 Re: upgraded from 7.1.3 to 7.2.4 and can't get JDBC to work
Previous Message Stuart Robinson 2002-07-02 07:32:33 Re: upgraded from 7.1.3 to 7.2.4 and can't get JDBC to work