dbTalk Databases Forums  

JDBS setArray

comp.databases.postgresql comp.databases.postgresql


Discuss JDBS setArray in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Philipp Kraus
 
Posts: n/a

Default JDBS setArray - 11-17-2009 , 07:40 AM






Hello,

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

Reply With Quote
  #2  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: JDBS setArray - 11-18-2009 , 06:04 AM






Philipp Kraus wrote:
Quote:
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.
Nothing PostgreSQL-related is off-topic here, but the JDBC
mailing list has more knowledgeable people reading it.

Quote:
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...2/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

Reply With Quote
  #3  
Old   
Philipp Kraus
 
Posts: n/a

Default Re: JDBS setArray - 11-18-2009 , 07:56 AM



On 2009-11-18 13:04:53 +0100, "Laurenz Albe" <invite (AT) spam (DOT) to.invalid> said:

Quote:
Philipp Kraus wrote:
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.

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...2/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.
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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.