|
Home > Archive > PostgreSQL JDBC > December 2005 > jdbc and ARRAYs
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| NosyMan 2005-12-02, 7:23 am |
| Hi everyone,
I have some problems trying to use a preparedStatement with an array
parameter. The problem is I don't know how to do it :-(
CREATE OR REPLACE FUNCTION MyFunction( id INTEGER, anArray
VARCHAR[] )..........................
pstat = conn.prepareStatement("SELECT * FROM MyFunction(?,?)");
pstat.setInt(1, 30);
pstat.setArray(2, ??????????);
Can you tell me how can I construct the array for parameter number 2?
Thanks,
NosyMan
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
| |
| Dave Cramer 2005-12-02, 7:23 am |
| You have to implement the java.sql.Array interface and pass that in.
search the list, there's a few references to this question and some
code.
Dave
On 2-Dec-05, at 4:42 AM, NosyMan wrote:
> Hi everyone,
>
> I have some problems trying to use a preparedStatement with an array
> parameter. The problem is I don't know how to do it :-(
>
> CREATE OR REPLACE FUNCTION MyFunction( id INTEGER, anArray
> VARCHAR[] )..........................
>
>
> pstat = conn.prepareStatement("SELECT * FROM MyFunction(?,?)");
> pstat.setInt(1, 30);
> pstat.setArray(2, ??????????);
>
> Can you tell me how can I construct the array for parameter number 2?
>
> Thanks,
> NosyMan
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly
| |
| Achilleus Mantzios 2005-12-02, 9:23 am |
| O Dave Cramer έγραψε στις Dec 2, 2005 :
> You have to implement the java.sql.Array interface and pass that in.
> search the list, there's a few references to this question and some
> code.
I think the easiest way to do this
is to simply construct your array strings,
and then deal with them as Strings.
>
> Dave
> On 2-Dec-05, at 4:42 AM, NosyMan wrote:
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql
.org so that your
> message can get through to the mailing list cleanly
>
--
-Achilleus
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
|
|
|
|
|