pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Roberta Campo <rcampo@mm.eutelsat.org>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: PreparedStatement.setXXX
Date: Tue, 19 Jul 2005 11:09:35 +1200
Message-ID: <42DC36AF.6060601@opencloud.com> (raw)
In-Reply-To: <dbg5ba$2g9c$3@news.hub.org>
References: <dbg5ba$2g9c$3@news.hub.org>

Roberta Campo wrote:

> A. Using the setArray method :
> This requires the implementation of the interface java.sql.Array :
> - which methods are required in this case ?
> - is there any available implementation of this class ? :)

Someone else replied to this with an implementation..

The driver's Array support is pretty bad currently. It will only work if
the Array implementation implements:

 - getBaseTypeName() returns the underlying postgresql type name ("int")
 - toString() returns a correctly-formatted array string ("{1,2,3}")

Proper support for arbitrary Array implementations (and bare arrays via
setObject) has been on my todo list for ages but it's no longer a high
priority for our application so I doubt I'll work on it any time soon :/

> B. Using the setObject(colnumber, String, type ) method :
> This should require less implementation than the Array, shouldn't it ?
> - how to specify the type int[] ?

JDBC has no mechanism to specify a particular array type via a Types.*
constant unfortunately :(

> C. Using different drivers / protocol versions / ...

Using protocol version 2 as Dave Cramer suggests is a short-term fix but
you don't want to be using that in the longer term..

-O



view thread (4+ messages)

Message-ID: <42DC36AF.6060601@opencloud.com>
Permalink:  ../42DC36AF.6060601@opencloud.com/
Also on:    postgresql.org/message-id/42DC36AF.6060601@opencloud.com

 · 

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: oliver@opencloud.com, rcampo@mm.eutelsat.org
  Subject: Re: PreparedStatement.setXXX
  In-Reply-To: <42DC36AF.6060601@opencloud.com>
  References: <dbg5ba$2g9c$3@news.hub.org> <42DC36AF.6060601@opencloud.com>

* 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