X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id B277A9FA15C for ; Tue, 16 May 2006 15:46:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 67582-06-4 for ; Tue, 16 May 2006 15:46:42 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with SMTP id 1D7C89FA999 for ; Tue, 16 May 2006 15:46:28 -0300 (ADT) Received: (qmail 4305 invoked by uid 1112); 16 May 2006 18:46:24 -0000 Date: Tue, 16 May 2006 13:46:24 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary2.csoft.net To: Chuck Davis cc: pgsql-jdbc@postgresql.org Subject: Re: JDBC driver and java strings In-Reply-To: <883e44790605161141h11ef46f4h4492214361aea050@mail.gmail.com> Message-ID: References: <883e44790605161141h11ef46f4h4492214361aea050@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/61 X-Sequence-Number: 15189 On Tue, 16 May 2006, Chuck Davis wrote: > Does anybody know if there is a plan to make the driver handle java > strings appropriately? I have hit a showstopper. If I enter data in > a JTextfield with an apostrophe the driver chokes with a syntax error. > I don't know how IBM does it but their JDBC driver handles > apostrophes without a problem. DB2 has been my main database but I'm > evaluating Postgresql on Linux. I can't ask my users to avoid > entering data with an apostrophe and I'm too lazy to program around it > since I know it can be done otherwise once and for all. If you use PreparedStatement.setString, any required quoting/escaping should be done for you. If you are building a SQL string yourself than you are responsible for escaping it correctly. You haven't said what you're doing, but I find it hard to believe that it's postgresql's fault or that DB2 has some magic to interpret bad data. Perhaps you could be more specific in what your code is doing? Kris Jurka