Re: Why is bool == java.sql.Types.BIT ?? - Mailing list pgsql-jdbc

From Thomas Kellerer
Subject Re: Why is bool == java.sql.Types.BIT ??
Date
Msg-id dm2umf$sga$1@sea.gmane.org
Whole thread Raw
In response to Re: Why is bool == java.sql.Types.BIT ??  (Kris Jurka <books@ejurka.com>)
Responses Re: Why is bool == java.sql.Types.BIT ??  (Oliver Jowett <oliver@opencloud.com>)
List 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

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: Logging from multiple connections
Next
From: Oliver Jowett
Date:
Subject: Re: Why is bool == java.sql.Types.BIT ??