Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TcyUM-0002d8-JI for pgsql-jdbc@arkaria.postgresql.org; Mon, 26 Nov 2012 13:12:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TcyUL-0001Qp-Md for pgsql-jdbc@arkaria.postgresql.org; Mon, 26 Nov 2012 13:12:41 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TcyUK-0001Qg-RX for pgsql-jdbc@postgresql.org; Mon, 26 Nov 2012 13:12:40 +0000 Received: from plane.gmane.org ([80.91.229.3]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TcyUJ-0003ps-23 for pgsql-jdbc@postgresql.org; Mon, 26 Nov 2012 13:12:40 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TcyUP-0002gE-6m for pgsql-jdbc@postgresql.org; Mon, 26 Nov 2012 14:12:45 +0100 Received: from 217.110.94.121 ([217.110.94.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 26 Nov 2012 14:12:45 +0100 Received: from spam_eater by 217.110.94.121 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 26 Nov 2012 14:12:45 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: Problems with BIT datatype and preparedStatment Date: Mon, 26 Nov 2012 14:12:49 +0100 Lines: 24 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 217.110.94.121 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Ermengol Bota, 26.11.2012 14:00: > Hello, > > sql.execute("Create Table jdbc_demo (b bit)"); > PreparedStatement pstmt = conn.prepareStatement("insert into jdbc_demo values (?)"); > pstmt.setBoolean(1,true); // There is no way to set a value for the bit field (or I don't know ... :-) > pstmt.execute(); > > Theorically (I think) it should works, but it answers: > > ERROR: column "b" is of type bit but expression is of type boolean > > We are working with PG 9.2.1 (one-click-installer on Ubuntu) and JDBC4 9.2-1002 > > After trying a lot of different types for the pstmt.setXXXX(), we think that there is something not working well, or we are missing something :-) > did you try pstmt.setString(1, "1"); (I find the boolean type much more "descriptive" anyway for true/false columns) -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc