Re: BUG #5948: JDBC wrond insert of timestamp data

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: BUG #5948: JDBC wrond insert of timestamp data
Дата
Msg-id alpine.BSO.2.00.1103251055350.9510@leary.csoft.net
обсуждение исходный текст
Ответ на BUG #5948: JDBC wrond insert of timestamp data  ("yuriy.tereschuk" <astro@evernet.lutsk.ua>)
Список pgsql-bugs
On Fri, 25 Mar 2011, yuriy.tereschuk wrote:

>
> The following bug has been logged online:
>
> Bug reference:      5948
> PostgreSQL version: postgresql90
> Operating system:   Linux Fedora 14
> Description:        JDBC wrond insert of timestamp data
> Details:
>
> org.postgresql.util.PSQLException: ERROR: column "datetime" is of type
> timestamp without time zone but expression is of type character varying
>  Hint: You will need to rewrite or cast the expression.
>
> JDBC version postgresql90-jdbc-9.0.801-1PGDG.f14.i686
>

You are most likely setting the timestamp value by using setString or
setObject with a string value on a PreparedStatement.  This is indicating
to the driver that you want the parameter to have a string (varchar) type.
This is not correct for a timestamp.  You should use setTimestamp or
setObject with a third parameter indicating that the value is a timestamp.
If you are unable to change your application for some reason, you can
adjust the driver's binding behavior by using the stringtype=unspecified
connection parameter described here:

http://jdbc.postgresql.org/documentation/84/connect.html#connection-parameters

Kris Jurka

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

Предыдущее
От: "Mihail Popov"
Дата:
Сообщение: BUG #5949: ODBC driver. Binding Arrays of Parameters
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5946: Long exclusive lock taken by vacuum (not full)