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>
Re: BUG #5948: JDBC wrond insert of timestamp data Kris Jurka <books@ejurka.com>
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
Дата:
От: Tom Lane
Дата:
FAQ