Re: jdbc driver problem?

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: jdbc driver problem?
Дата
Msg-id 4469665D.6050607@opencloud.com
обсуждение исходный текст
Ответ на jdbc driver problem?  ("sathish kumar shanmugavelu" <sathishkumar.shanmugavelu@gmail.com>)
Список 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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "sathish kumar shanmugavelu"
Дата:
Сообщение: jdbc driver problem?
Следующее
От: Andy Jefferson
Дата:
Сообщение: Re: JPOX Types.CHAR error