Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id AD00C1337BE2 for ; Fri, 25 Mar 2011 12:00:50 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 39857-08 for ; Fri, 25 Mar 2011 15:00:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by mail.postgresql.org (Postfix) with ESMTP id E1D531337BCD for ; Fri, 25 Mar 2011 12:00:32 -0300 (ADT) Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail63.csoft.net (Postfix) with ESMTP id 1B2452843A; Fri, 25 Mar 2011 11:00:32 -0400 (EDT) Received: by leary.csoft.net (Postfix, from userid 1112) id BE23DA3D7; Fri, 25 Mar 2011 11:00:31 -0400 (EDT) Date: Fri, 25 Mar 2011 11:00:31 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: "yuriy.tereschuk" cc: pgsql-bugs@postgresql.org Subject: Re: BUG #5948: JDBC wrond insert of timestamp data In-Reply-To: <201103251058.p2PAwRvs068704@wwwmaster.postgresql.org> Message-ID: References: <201103251058.p2PAwRvs068704@wwwmaster.postgresql.org> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/329 X-Sequence-Number: 29839 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