Re: Timestamps without time zone

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Timestamps without time zone
Date: 2008-01-09 12:43:25
Message-ID: 4784C16D.6060003@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Achilleas Mantzios wrote:

> Now instead of the above i tried something that should be "more" correct and
> according to specs
> Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
> st = con.prepareStatement("select
> utcts,latid,longi,tracktrue,avgspeed,minspeed,maxspeed from gpscookeddata
> where vslid=? and utcts<? and utcts>=? order by utcts");
> st.setInt(1,Integer.parseInt(vslid));
> st.setTimestamp(2,new java.sql.Timestamp(gendDate.getTime()),cal);
> st.setTimestamp(3,new java.sql.Timestamp(gstartDate.getTime()),cal);
> however again i see that the JDBC insists producing code like:
> select utcts,latid,longi,tracktrue,avgspeed,minspeed,maxspeed from
> gpscookeddata where vslid=92 and utcts<'2006-03-26 07:00:00.000000+03' and
> utcts>='2006-03-26 05:00:00.000000+03' order by utcts

This is unexpected - as you say the driver should generate timestamp
values in UTC if you pass a UTC calendar to setTimestamp.

Which driver version are you using?
How are you concluding that the JDBC driver is sending +03 values?

The driver will not generate a query string like you quoted above as it
uses parameter placeholders (assuming you are using protocol version 3
anyway) and sends the values out of line, which is why I'm asking.

-O

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Achilleas Mantzios 2008-01-09 12:56:29 Re: Timestamps without time zone
Previous Message Achilleas Mantzios 2008-01-09 12:30:51 Re: Timestamps without time zone