i try to use the setArray method of postgres (8.3) JDBC driver to send
data to a function.
I hope I'm not off topic here with this problem.
In my code I have some java.lang.Double-Arrays whitch I must convert in
that way, that
I can use them in the prepare-statement context with setArray.
I found some information that I can convert the double Array to a
string list like
"..array[1,2,3,....]" but I have around 500 elements in 5 Arrays and I
would like
to send them without string reprensation
How can I do that?
Thanks
Phil
Nothing PostgreSQL-related is off-topic here, but the JDBC
mailing list has more knowledgeable people reading it.
> In my code I have some java.lang.Double-Arrays whitch I must convert in that way, that
> I can use them in the prepare-statement context with setArray.
>
> I found some information that I can convert the double Array to a string list like
> "..array[1,2,3,....]" but I have around 500 elements in 5 Arrays and I would like
> to send them without string reprensation
>
> How can I do that?
I found the following thread in the archives:
http://archives.postgresql.org/pgsql-jdbc/2008-12/msg00040.php
The two options suggested are:
- Implement the java.sql.Array interface with your types.
- Use the JDBC4 driver (requires Java 6) and use the
java.sql.Connection.createArrayOf() method.
Yours,
Laurenz Albe
In had hoped there are onther solutions. Exactly this thread
I had read before I had post. I can't use JDBC 4 because I
limited on Java 1.5 now. So I implementated the function
into the application in a transaction
Thanks