Re: Literal vs parameterized 'timestamp with time zone' value - Mailing list pgsql-jdbc

From Heikki Linnakangas
Subject Re: Literal vs parameterized 'timestamp with time zone' value
Date
Msg-id 46767EC3.3020505@enterprisedb.com
Whole thread Raw
In response to Literal vs parameterized 'timestamp with time zone' value  (Christopher Hunt <huntc@internode.on.net>)
Responses Re: Literal vs parameterized 'timestamp with time zone' value  (Christopher Hunt <huntc@internode.on.net>)
List pgsql-jdbc
Christopher Hunt wrote:
> However if I use a parameter:
>
> PreparedStatement sqlStatement =
>   sqlConnection.prepareStatement("select validtime from
> moving_object_status where validtime < ?");
> int columnIndex = 1;
> sqlStatement.setString(columnIndex++, "2005-06-08T20:05:45.825+0");
>
> No rows are returned.
>
> Can anyone explain the difference in results given a literal value and a
> parameterised value in this context?

I don't really have an explanation, but I would recommend using
setTimestamp instead of setString for timestamp values.

Maybe there's a time or timezone difference between client and server,
and in the former case the server setting is used, and in the latter,
the client setting?

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

pgsql-jdbc by date:

Previous
From: Christopher Hunt
Date:
Subject: Re: Literal vs parameterized 'timestamp with time zone' value
Next
From: Dave Cramer
Date:
Subject: Re: Literal vs parameterized 'timestamp with time zone' value