pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Why is bool == java.sql.Types.BIT ??
Date: Fri, 25 Nov 2005 09:50:03 +1300
Message-ID: <4386277B.8070906@opencloud.com> (raw)
In-Reply-To: <dm4q1m$qk1$1@sea.gmane.org>
References: <dm29na$nrg$1@sea.gmane.org>
	<Pine.BSO.4.61.0511231340310.14387@leary.csoft.net>
	<dm2umf$sga$1@sea.gmane.org>
	<43850037.5000608@opencloud.com>
	<dm4q1m$qk1$1@sea.gmane.org>

Thomas Kellerer wrote:
> Oliver Jowett wrote on 24.11.2005 00:50:
> 
>> Thomas Kellerer wrote:
>>
>>> The problem comes when supporting multiple DBMS. With MS SQL Server a 
>>> bit column can only store 0/1 (which is not what the driver returns, 
>>> as it uses a java.lang.Boolean) but PG only accepts the literals 
>>> true/false. That's why I stumbled over this in the first place.
>>>
>>> So I'll have to check the native type rather then the JDBC type to be 
>>> sure.
>>
>>
>>
>> Can't you use setBoolean()/getBoolean()? I think that's specified to 
>> always work on a BIT column, whatever the real underlying type is.
>>
> 
> Yes of course I can and actually I do when using PreparedStatements
> But when I'm generating SQL Scripts I need to use the correct literal 
> for such a column.

Well, if you're going to bypass the abstractions that JDBC gives you to 
deal with this sort of case, of course you will end up with 
DBMS-specific code..

-O



view thread (12+ messages)  latest in thread

Message-ID: <4386277B.8070906@opencloud.com>
Permalink:  ../4386277B.8070906@opencloud.com/
Also on:    postgresql.org/message-id/4386277B.8070906@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, spam_eater@gmx.net
  Subject: Re: Why is bool == java.sql.Types.BIT ??
  In-Reply-To: <4386277B.8070906@opencloud.com>
  References: <dm29na$nrg$1@sea.gmane.org> <Pine.BSO.4.61.0511231340310.14387@leary.csoft.net> <dm2umf$sga$1@sea.gmane.org> <43850037.5000608@opencloud.com> <dm4q1m$qk1$1@sea.gmane.org> <4386277B.8070906@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