Re: PreparedStatement and TYPE bit

From: Kris Jurka <books(at)ejurka(dot)com>
To: Ingmar Lötzsch <iloetzsch(at)asci-systemhaus(dot)de>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: PreparedStatement and TYPE bit
Date: 2006-12-01 14:07:55
Message-ID: Pine.BSO.4.64.0612010904490.22186@leary2.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, 28 Nov 2006, Ingmar Lötzsch wrote:

> Ingmar Lötzsch schrieb:
>> Hallo,
>>
>> how can I use PreparedStatement to insert or update columns of type
>> bit(n), varbit, ...?
>>
>> I have never figoured out the right way. In former versions of the
>> JDBC-Driver I used setString() as shown below or constructed the whole
>> query string and used Statement.

With the 8.0 and 8.1 driver you would need to write code that is specific
to postgresql using the PGobject class to pass the correct type
information to setObject.

You can does this again with the 8.2 driver if you add the URL parameter
stringtype=unspecified.

I think the best long term approach is for getObject and setObject to
return/take BitSet objects directly so no conversion to string is needed.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2006-12-01 14:09:59 Re: ParsedStatement Behavior
Previous Message Kris Jurka 2006-12-01 14:04:30 Re: setBlob/getBlob, slony and bytea