Re: - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re:
Date
Msg-id CADK3HH+gULQ6dcRZ0euKZ63r8_jNjJN5HeJ0Pq5dCHvtRSoq4Q@mail.gmail.com
Whole thread Raw
In response to ...  (News Subsystem <news@news.hub.org>)
List pgsql-jdbc
Going from my vague memory. We need the ? as a placeholder for the parameter. AFAIR this is a legitimate use of the API.

Dave

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Wed, Feb 20, 2013 at 9:01 AM, News Subsystem <news@news.hub.org> wrote:
        Wed, 20 Feb 2013 06:01:21 -0800 (PST)
 Wed, 20 Feb 2013 06:01:21 -0800 (PST)
X-Newsgroups: pgsql.interfaces.jdbc
Date: Wed, 20 Feb 2013 06:01:21 -0800 (PST)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=174.115.190.53;
 posting-account=hKFGKAkAAAB4U5rGhRuB_p6PSIbpGEph
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <633775d5-77ad-4f49-bf2e-3d5868e26e04@googlegroups.com>
Subject: question about PG JDBC expects results of procedures to be consumed
From: thesix campbells <the6campbells@gmail.com>
Injection-Date: Wed, 20 Feb 2013 14:01:21 +0000
Content-Type: text/plain; charset=ISO-8859-1
To: pgsql-jdbc@postgresql.org

Can someone clarify why the PG/JDBC driver will not support this style of JDBC methods to consume result sets and instead requires the 2nd form. I see examples of how (re 2nd) but not necessarily explanation re why other approaches may not be supported.

org.postgresql.util.PSQLException: Bad value for type int : <unnamed portal 1>

String sproc = "{call pres()}";
CallableStatement cs = conn.prepareCall(sproc);
boolean hasResults = cs.execute();
while (hasResults) {
        rs = cs.getResultSet();
        while (rs.next()) {
                ....
        }
        rs.close();
        hasResults = cs.getMoreResults();
}
cs.close();


String sproc = "{? = call pres()}";
CallableStatement cs = conn.prepareCall(sproc);
cs.registerOutParameter(1, Types.OTHER);
cs.execute();


--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

pgsql-jdbc by date:

Previous
From: Ioana Danes
Date:
Subject: Ioana Danes
Next
From: Maz Mohammadi
Date:
Subject: confirming security.