JDBC question: Creating new arrays

From: Joe Tomcat <tomcat(at)mobile(dot)mp>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: JDBC question: Creating new arrays
Date: 2002-11-13 19:00:20
Message-ID: 1037214022.1472.6.camel@linux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It seems that there is a difficulty in JDBC with creating arrays. I
have an array of ints that I want to store in PG. If I try code like
this:

int[] intArray = { .... };
PreparedStatement ps = db.prepareStatement(...);
ps.setObject(1, intArray);

it doesn't work. There is a PreparedStatement.setArray() method, but it
takes a java.sql.Array as an argument, and yet the Array interface
doesn't define any constructors and there doesn't seem to be any factory
for it either!!!!

Help! What do I do here? Can I fix this by moving over to the new
javax.sql packages? Do I need to use some non-portable code?

Thanks!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2002-11-13 19:17:55 Re: readline help
Previous Message Artur Rataj 2002-11-13 18:46:20 Re: Comparing strings with non-ASCII characters