Re: PreparedStatement.setXXX

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Roberta Campo <rcampo(at)mm(dot)eutelsat(dot)org>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: PreparedStatement.setXXX
Date: 2005-07-18 23:09:35
Message-ID: 42DC36AF.6060601@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-07-18 23:11:01 Re: Timestamp Conversion Woes Redux
Previous Message Dave Cramer 2005-07-18 21:28:20 Re: Timestamp Conversion Woes Redux