From: Kris Jurka <books@ejurka.com>
To: yuriy.tereschuk <astro@evernet.lutsk.ua>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #5948: JDBC wrond insert of timestamp data
Date: Fri, 25 Mar 2011 11:00:31 -0400 (EDT)
Message-ID: <alpine.BSO.2.00.1103251055350.9510@leary.csoft.net> (raw)
In-Reply-To: <201103251058.p2PAwRvs068704@wwwmaster.postgresql.org>
References: <201103251058.p2PAwRvs068704@wwwmaster.postgresql.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: books@ejurka.com, astro@evernet.lutsk.ua
Subject: Re: BUG #5948: JDBC wrond insert of timestamp data
In-Reply-To: <alpine.BSO.2.00.1103251055350.9510@leary.csoft.net>
References: <201103251058.p2PAwRvs068704@wwwmaster.postgresql.org> <alpine.BSO.2.00.1103251055350.9510@leary.csoft.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox