Thread: Passing an array or record to a stored procedure through jdbc

Passing an array or record to a stored procedure through jdbc

From
Roshan Nair
Date:
Hi all,

I'm using Postgresql 8.1 with driver postgresql-8.1-404.jdbc3.jar .  Our
project depends a lot on stored procedures(pl/pgsql). We need to pass
arrays,  records and in some cases array of records as a parameter to
the stored procedure. I've searched the mailing lists and googled a lot
but found no solution. For now, we are passing a varchar of
comma-separated values and parsing this in the stored procedure.  But
this solution becomes non-trivial when we are using array of records.
I would like to know if we can pass/return arrays and records using jdbc
to/from postgres stored procedures. I guess even multidimensional arrays
are fine, if we cant have records.
Is it possible to implement and add our own array types or record types
easily?(I'm a beginner-intermediate jdbc user).
The jdbc.postgres home page seems to say array support is a feature for
8.2, but the 8.1-404 jdbc driver already contains array type.

Regards,
Roshan Nair

----------------------------------------------------------
Netcore Solutions Pvt. Ltd.
Website:  http://www.netcore.co.in
Spamtraps: http://cleanmail.netcore.co.in/directory.html

Support FAQ : http://support.netcore.co.in/
----------------------------------------------------------