Re: Timestamps without time zone - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Timestamps without time zone
Date
Msg-id 4784C16D.6060003@opencloud.com
Whole thread Raw
In response to Re: Timestamps without time zone  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
Responses Re: Timestamps without time zone
List 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

pgsql-jdbc by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: Timestamps without time zone
Next
From: Achilleas Mantzios
Date:
Subject: Re: Timestamps without time zone