Re: Why is bool == java.sql.Types.BIT ??

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Why is bool == java.sql.Types.BIT ??
Date: 2005-11-23 23:41:03
Message-ID: dm2umf$sga$1@sea.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-11-23 23:50:15 Re: Why is bool == java.sql.Types.BIT ??
Previous Message Oliver Jowett 2005-11-23 23:28:38 Re: Logging from multiple connections