X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 50A738B9F85 for ; Mon, 31 Jan 2005 19:37:11 +0000 (GMT) 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 44866-03 for ; Mon, 31 Jan 2005 19:36:59 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id CEE638B9E95 for ; Mon, 31 Jan 2005 19:35:10 +0000 (GMT) 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 (Exim 3.35 #1 (Debian)) id 1CvhJp-0005iR-00; Tue, 01 Feb 2005 08:34:41 +1300 Message-ID: <41FE884E.2040004@opencloud.com> Date: Tue, 01 Feb 2005 08:34:38 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Venkatesh Babu Cc: pgsql-jdbc@postgresql.org Subject: Re: Help with exception: java.lang.IllegalArgumentException: References: <20050131072145.83421.qmail@web50402.mail.yahoo.com> In-Reply-To: <20050131072145.83421.qmail@web50402.mail.yahoo.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime 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, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/299 X-Sequence-Number: 12179 Venkatesh Babu wrote: > I'm getting an exception > "java.lang.IllegalArgumentException: \0 not allowed" > while using '\0' terminated strings as parameters for > the PreparedStatement. May I know whether usage of > such strings is not permitted? I'm using the > PreparedStatement.setString(int parameterIndex, String > x) function to set the parameters and I get the > exception here. You can't use \0 in text types (text, varchar, char, etc); this is a limitation of the server and the server/client protocol. The driver is just catching it early so you don't see strange behaviour later. In general, you don't need to terminate Java strings with \0 at all. If you really do need to store a literal NUL, consider using a bytea column and PreparedStatement.setBytes() instead. -O