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 136A69F9CEE for ; Tue, 16 May 2006 02:43:11 -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 54358-08-3 for ; Tue, 16 May 2006 02:43:01 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id 952A09F944D for ; Tue, 16 May 2006 02:43:00 -0300 (ADT) Received: from 221x253x225x162.ap221.ftth.ucom.ne.jp ([221.253.225.162] helo=[192.168.1.169]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1FfsKe-0006AU-OH; Tue, 16 May 2006 17:42:57 +1200 Message-ID: <4469665D.6050607@opencloud.com> Date: Tue, 16 May 2006 14:42:53 +0900 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: sathish kumar shanmugavelu CC: pgsql-jdbc@postgresql.org Subject: Re: jdbc driver problem? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/50 X-Sequence-Number: 15178 sathish kumar shanmugavelu wrote: > We used a query like > SELECT * FROM patient_head WHERE patient_name = ? > in the prepared statement. And set the parameter as setString(1,name) > , where 'name' is the java string variable. > while printing the prepared statement the query is displayed like > SELECT * FROM patient_head WHERE patient_name = James Cameroon > instead of > SELECT * FROM patient_head WHERE patient_name = 'James > Cameroon' > with single quotes. The JDBC API doesn't require that PreparedStatement.toString() will return the actual SQL to be executed, and the current driver doesn't try to get string escaping correct in toString(). It's a purely cosmetic issue, the query is correct when sent to the server. In fact, at the protocol level, the parameter values are *not* interpolated into the query string, they are sent separately. > It happens in both the 7.4.7 and 8.1 version of the postgresql. > Because of this the query does not executes and no result is fetched. The cause of your problem is something else. The return value of toString() is not relevant. If you run the same query via psql, does it return results? -O