pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: Why is bool == java.sql.Types.BIT ??
Date: Thu, 24 Nov 2005 00:41:03 +0100
Message-ID: <dm2umf$sga$1@sea.gmane.org> (raw)
In-Reply-To: <Pine.BSO.4.61.0511231340310.14387@leary.csoft.net>
References: <dm29na$nrg$1@sea.gmane.org>
	<Pine.BSO.4.61.0511231340310.14387@leary.csoft.net>

Kris Jurka wrote on 23.11.2005 19:41:
>> I noticed that table columns that are defined as "bool" (Postgres 
>> datatype) are reported as java.sql.Types.BIT through DatabaseMetadata 
>> (or ResultSetMetaData).
>>
>> Is there any valid reason why they are not reported as 
>> java.sql.Types.BOOLEAN?
>>
> 
> Because BOOLEAN is only available to JDBC3.  Our driver still supports 
> JDBC2 so we use BIT.  BOOLEAN and BIT are the same thing as far as we 
> can tell.

Makes sense. I knew there was a reason :)

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.

Regards
Thomas




view thread (12+ messages)  latest in thread

Message-ID: <dm2umf$sga$1@sea.gmane.org>
Permalink:  ../dm2umf$sga$1@sea.gmane.org/
Also on:    postgresql.org/message-id/dm2umf$sga$1@sea.gmane.org

 · 

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: spam_eater@gmx.net
  Subject: Re: Why is bool == java.sql.Types.BIT ??
  In-Reply-To: <dm2umf$sga$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>

* 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