pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adam Zimowski <zimowski74@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: JDBC support for 8.1 OUT parameters
Date: Sun, 5 Mar 2006 10:46:11 -0600
Message-ID: <7c6c1dd90603050846j6d1987ffnbbddbcd01f0fd11f@mail.gmail.com> (raw)
In-Reply-To: <7c6c1dd90603050826o12028bbej847550e44dc7c0c8@mail.gmail.com>
References: <7c6c1dd90603050826o12028bbej847550e44dc7c0c8@mail.gmail.com>

Just a quick note:

In my code I'm using Types.OTHER.  As a troubleshooting step I also
tried Types.REF. The PostgreSQL version I'm on is 8.1.0.

CREATE OR REPLACE FUNCTION main.p_get_profile_simple(IN _profile_id
int8, OUT _main refcursor, OUT _lookingfor refcursor, OUT _purpose
refcursor) AS
....

CallableStatement stmt = null;
stmt = oCon.prepareCall("{ call main.p_get_profile_simple(?,?,?,?) }");
stmt.setLong(1, aMemberId);
stmt.registerOutParameter(2, Types.OTHER);
stmt.registerOutParameter(3, Types.OTHER);
stmt.registerOutParameter(4, Types.OTHER);

Regards,
Adam

On 3/5/06, Adam Zimowski <zimowski74@gmail.com> wrote:
> Hi,
>
> Do you know where I can find Postgres JDBC driver that supports out
> parameters? When I call my procedure, I'm getting:
>
> org.postgresql.util.PSQLException: A CallableStatement function was
> executed and the return was of type java.sql.Types=1111 however type
> java.sql.Types=0 was registered.
>
> I'm pretty sure the driver version I have
> (postgresql-8.1-405.jdbc3.jar) supports OUT only on first parameter.
> I've looked on the web but did not find anything. I saw a few patches,
> but I wasn't sure if they were it.
>
> CREATE OR REPLACE FUNCTION main.p_get_profile_simple(IN _profile_id
> int8, OUT _main refcursor, OUT _lookingfor refcursor, OUT _purpose
> refcursor) AS
> ....
>
> CallableStatement stmt = null;
> stmt = oCon.prepareCall("{ call main.p_get_profile_simple(?,?,?,?) }");
> stmt.setLong(1, aMemberId);
> stmt.registerOutParameter(2, Types.REF);
> stmt.registerOutParameter(3, Types.REF);
> stmt.registerOutParameter(4, Types.REF);
>
> Regards,
> Adam
>



view thread (3+ messages)  latest in thread

Message-ID: <7c6c1dd90603050846j6d1987ffnbbddbcd01f0fd11f@mail.gmail.com>
Permalink:  ../7c6c1dd90603050846j6d1987ffnbbddbcd01f0fd11f@mail.gmail.com/
Also on:    postgresql.org/message-id/7c6c1dd90603050846j6d1987ffnbbddbcd01f0fd11f@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: zimowski74@gmail.com
  Subject: Re: JDBC support for 8.1 OUT parameters
  In-Reply-To: <7c6c1dd90603050846j6d1987ffnbbddbcd01f0fd11f@mail.gmail.com>
  References: <7c6c1dd90603050826o12028bbej847550e44dc7c0c8@mail.gmail.com> <7c6c1dd90603050846j6d1987ffnbbddbcd01f0fd11f@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox