X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 206E7DBA1D for ; Thu, 24 Nov 2005 16:50:06 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99521-03 for ; Thu, 24 Nov 2005 20:50:06 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by svr1.postgresql.org (Postfix) with ESMTP id 4F62DDBC6F for ; Thu, 24 Nov 2005 16:50:03 -0400 (AST) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EfO2e-0000kE-35; Fri, 25 Nov 2005 09:50:04 +1300 Message-ID: <4386277B.8070906@opencloud.com> Date: Fri, 25 Nov 2005 09:50:03 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051009) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Thomas Kellerer CC: pgsql-jdbc@postgresql.org Subject: Re: Why is bool == java.sql.Types.BIT ?? References: <43850037.5000608@opencloud.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/195 X-Sequence-Number: 14293 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