From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | sathish kumar shanmugavelu <sathishkumar(dot)shanmugavelu(at)gmail(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: jdbc driver problem? |
Date: | 2006-05-16 05:42:53 |
Message-ID: | 4469665D.6050607@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Jefferson | 2006-05-16 07:08:04 | Re: JPOX Types.CHAR error |
Previous Message | sathish kumar shanmugavelu | 2006-05-16 03:51:26 | jdbc driver problem? |