"out" parameters in CallableStatements

From: "David Parker" <dparker(at)tazznetworks(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: "out" parameters in CallableStatements
Date: 2004-09-23 16:32:16
Message-ID: 07FDEE0ED7455A48AC42AC2070EDFF7C0C0223@corpsrv2.tazznetworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi. I need to provide a stored procedure interface to my postgres
database that conforms as much as possible to an existing Oracle stored
procedure interface in a product with which we are integrating. These
are called via JDBC. The Oracle interface has OUT parameters, which are
not supported by postgres, so I assume my stored procedures just need to
return this value (luckily, they only seem to have one OUT parameter per
procedure, which they use for a result).

I'm not sure how to handle this at the JDBC level. The example in the
postgres documentation (page 417 in the 7.4 doc) gives:

CallableStatement upperProc = con.prepareCall("{ ? = call upper( ? )
}");
upperProc.registerOutParameter(1, Types.VARCHAR);
upperProc.setString(2, "lowercase to uppercase");
upperProc.execute();
String upperCased = upperProc.getString(1);
upperProc.close();

Is the JDBC driver doing something special to support the
registerOutParameter call? Assuming that it is using this to map the
return value of the stored procedure, does it check that only one OUT
parameter is registered, or limit it to parameter 1?

TIA for any info.

- DAP
======================================================
David Parker Tazz Networks (401) 709-5130

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-09-23 18:50:58 Re: Integer fields
Previous Message Qi, Xlaoyan 2004-09-23 16:28:04 telnet to port 5432 failed