pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alex Stienstra <alex.stienstra@zonnet.nl>
To: pgsql-jdbc@postgresql.org
Subject: setArray
Date: Fri, 16 Feb 2007 11:51:03 +0100
Message-ID: <20070216115103.8tagbdi2edy8g8kk@webmail.versatel.nl> (raw)

Hi,

Iam trying to set an array in a prepared statement like this:

PreparedStatement stmnt = ds.prepareStatement(
  "INSERT INTO trainingen (\"Atleet\", \"Datum\", \"Tijdstip\", 
\"Afstand\", \"Tijd (Zone)\") VALUES (?,?,?,?,?)"
);
    stmnt.setString(5, "{1,2,3,4,5,6}");

Assuming that the 5th parameter is an array of integer i get the follow 
error message:

ERROR: column "Tijd (Zone)" is of type integer[] but expression is of 
type character varying

I understood from previous discussions that the driver underwater will 
convert the parameter of setArray
into a string representation like i do in the example above. I there 
any other way of setting an array
field in a prepared statement?

Alex.





view thread (6+ messages)  latest in thread

Message-ID: <20070216115103.8tagbdi2edy8g8kk@webmail.versatel.nl>
Permalink:  ../20070216115103.8tagbdi2edy8g8kk@webmail.versatel.nl/
Also on:    postgresql.org/message-id/20070216115103.8tagbdi2edy8g8kk@webmail.versatel.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: alex.stienstra@zonnet.nl
  Subject: Re: setArray
  In-Reply-To: <20070216115103.8tagbdi2edy8g8kk@webmail.versatel.nl>
  References: <20070216115103.8tagbdi2edy8g8kk@webmail.versatel.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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