Thread: Bug in PostgreSQL JDBC Drive.

Bug in PostgreSQL JDBC Drive.

From
Raymond Chui
Date:
I have PostgreSQL jdbc7.0-1.2.jar JDBC drive.

I found out if a column of a table is Timestamp data type

Properties p = new Properties();
p.put("PGTZ", "GMT");

This does not take effect when you do
SELECT/UPDATE/INSERT/DELETE (QUID).
It gives me the local time zone.

This should be the same as set environment
"export PGTZ=GMT" or "setenv PGTZ GMT"
in UNIX, right?

I have to do
connection = driver.connect('myjdbcURL", p);
Statement st = connection.createStatement();
st.execute("SET TIME ZONE 'GMT'");

Well, this takes effect when I do INSERT/UPDATE
(I don't know DELETE yet). But it still does not take
effect when I do SELECT, I still get the local time
zone.

If you don't think that's is a bug, please tell me your solution(s).
Thank you very much in advance!

--Raymond


Attachment

Re: Bug in PostgreSQL JDBC Drive.

From
Peter Mount
Date:
At 09:43 16/03/01 -0500, Raymond Chui wrote:

Delayed as I only read General once in a while - jdbc mails should go to
the jdbc list.

>I have PostgreSQL jdbc7.0-1.2.jar JDBC drive.
>
>I found out if a column of a table is Timestamp data type
>
>Properties p = new Properties();
>p.put("PGTZ", "GMT");
>
>This does not take effect when you do
>SELECT/UPDATE/INSERT/DELETE (QUID).
>It gives me the local time zone.
>
>This should be the same as set environment
>"export PGTZ=GMT" or "setenv PGTZ GMT"
>in UNIX, right?

Nope... PGTZ is a libpq thing, and jdbc has nothing to do with libpq.


>I have to do
>connection = driver.connect('myjdbcURL", p);
>Statement st = connection.createStatement();
>st.execute("SET TIME ZONE 'GMT'");

Correct method.