pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Passing arrays
2+ messages / 2 participants
[nested] [flat]

* Passing arrays
@ 2008-07-24 17:27  Konrad Machlowski <travikkman@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Konrad Machlowski @ 2008-07-24 17:27 UTC (permalink / raw)
  To: pgsql-jdbc

Hello.

I've been looking for a way to pass from Java an array value (
Object[]/Integer[]/String[]/... ) to postgresql int2[]/varchar[] stored
function.
Can somebody point me to anything, please?

-- 
Regards,
TrAvIkK

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Passing arrays
@ 2008-07-29 04:10  Kris Jurka <books@ejurka.com>
  parent: Konrad Machlowski <travikkman@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Kris Jurka @ 2008-07-29 04:10 UTC (permalink / raw)
  To: Konrad Machlowski <travikkman@gmail.com>; +Cc: pgsql-jdbc



On Thu, 24 Jul 2008, Konrad Machlowski wrote:

> I've been looking for a way to pass from Java an array value (
> Object[]/Integer[]/String[]/... ) to postgresql int2[]/varchar[] stored
> function.

You need to call setArray on a PreparedStatement or CallableStatement. 
This takes java.sql.Array instead of Integer[].  You can create a 
java.sql.Array easily if you're using a recent JDBC4 driver via 
Connection.createArrayOf.  If it's an older driver than you must create
a class that implementes java.sql.Array yourself.

Kris Jurka




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2008-07-29 04:10 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-07-24 17:27 Passing arrays Konrad Machlowski <travikkman@gmail.com>
2008-07-29 04:10 ` Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox