Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: Passing arrays





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




Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group