Skip site navigation (1) Skip section navigation (2)

Re: Timestamp Problems

From: Kris Jurka <books(at)ejurka(dot)com>
To: David Rees <drees76(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Timestamp Problems
Date: 2008-07-29 04:22:52
Message-ID: Pine.BSO.4.64.0807290018110.2814@leary.csoft.net (view raw or flat)
Thread:
Lists: pgsql-jdbc

On Wed, 23 Jul 2008, David Rees wrote:

> What is strange is that this does not happen all the time, and that it
> only affects this one particular column!

Anything going wrong should be reproducible unless your app is doing 
something weird temporarily behind the scenes like TimeZone.setDefault.

> Timestamp 1 = 2008-07-23 18:33:59.0 - new Date: Wed Jul 23 18:33:59 EDT 2008
> Update & Refresh
> Timestamp 2 = 2008-07-23 22:33:59.0 - new Date: Wed Jul 23 18:33:59 EDT 2008
>
> Yeah, that's right, getTime() is returning the same value even though
> toString() prints different values and different values get inserted
> in to the database!

You need to check getTimezoneOffset on the two timestamp values.  You 
can see the dates being printed with the timezone showing they're the 
same, but I'm betting they aren't for the timestampts.

> After a lot of troubleshooting, I've finally figured out that by
> disabling the stored procedure cache used by Hibernate (I've
> configured Hibernate to use c3p0's database connection pool and
> prepared statement cache) this issue doesn't crop up any more.
>

I can't imagine why that would be relevant.

Kris Jurka


In response to

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2008-07-29 04:35:27
Subject: Re: GSSAPI/KRB5 and JDBC (again)
Previous:From: Kris JurkaDate: 2008-07-29 04:17:26
Subject: Re: numeric type

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group