From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | Eliézer Madeira de Campos <eliezer(at)diuno(dot)com(dot)br> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: 7.3 -> 8.0.4 migration timestamp problem |
Date: | 2005-11-07 05:51:56 |
Message-ID: | 436EEB7C.7090607@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Eliézer Madeira de Campos wrote:
> 1) Timestamp before 1914.
> When I execute the query by java statement no problem occurs, but when I execute the query
> by java preparedstatement this is what happens:
>
> PreparedStatement pst = con.prepareStatement("insert into teste values (?, ?, ?)");
> pst.setObject(1, new Integer(1));
> pst.setObject(2, "TESTE");
> Calendar c = new GregorianCalendar(1913, 0, 1, 0, 0, 0);
> Timestamp t = new Timestamp(c.getTimeInMillis());
> pst.setTimestamp(3, t);
> pst.executeUpdate();
>
> The date stored in database is actually 1912-12-31 23:53:12.0 (however it should have stored 1913-01-01.
>
> I have already debugged the Postgres-8.0 (build 313) driver and it seems to send the correct date to database.
I could not reproduce this problem using the attached testcase against
8.0.3 and the build 313 driver. I get the expected output:
> $ java -classpath .:postgresql-8.0-313.jdbc3.jar TestTimestamp6 'jdbc:postgresql:test?user=oliver'
> 1 => 1913-01-01 00:00:00.0 (literal '1913-01-01 00:00:00')
What are you doing differently? Perhaps the JVM and server timezone
settings are important, what are you using?
-O
Attachment | Content-Type | Size |
---|---|---|
TestTimestamp6.java | text/plain | 1.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Dugan | 2005-11-07 07:38:50 | Re: begginer question jdbc not working (solved) |
Previous Message | Kris Jurka | 2005-11-06 22:34:43 | Re: Stable JDBC drivers for 8.1 |