db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Kruse (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-4582) Timestamps inserted with GMT calendar are 1 hour later when subsequently read with GMT calendar (Server Mode Only).
Date Mon, 15 Mar 2010 15:28:27 GMT

     [ https://issues.apache.org/jira/browse/DERBY-4582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Keith Kruse updated DERBY-4582:
-------------------------------

    Attachment: DerbyTest.java

Thanks for looking at this!

The test class has a "dbmode" enum variable that allows it to run in Client or Embedded mode.
 The error only happend in Client mode.

I run the test in the America/Chicago time zone.  The test timestamp data have to change to
test in other timezones.

I am including two sets of output from the test.  The first set shows failure in client mode
(search for *FAILED).  The second set shows success in embedded mode.

Database Mode:   CLIENT
Local Time Zone: Central Standard Time
Using Client Driver: org.apache.derby.jdbc.ClientDriver
Using Client URL: jdbc:derby://localhost:1527/C:\temp\dst_test_db;user=app;password=app;create=true
Dropping Table...
Creating Table...
Mar 13, 2010 10:01:00 PM GMT	(Mar 13, 2010 4:01:00 PM CST)	ok	-> (Mar 13, 2010 10:01:00
PM GMT)	Wrote: 1268517660000	Read: 1268517660000
Mar 13, 2010 11:01:00 PM GMT	(Mar 13, 2010 5:01:00 PM CST)	ok	-> (Mar 13, 2010 11:01:00
PM GMT)	Wrote: 1268521260000	Read: 1268521260000
Mar 14, 2010 12:01:00 AM GMT	(Mar 13, 2010 6:01:00 PM CST)	ok	-> (Mar 14, 2010 12:01:00
AM GMT)	Wrote: 1268524860000	Read: 1268524860000
Mar 14, 2010 1:01:00 AM GMT	(Mar 13, 2010 7:01:00 PM CST)	ok	-> (Mar 14, 2010 1:01:00 AM
GMT)	Wrote: 1268528460000	Read: 1268528460000
Mar 14, 2010 2:01:00 AM GMT	(Mar 13, 2010 8:01:00 PM CST)	*FAILED	-> (Mar 14, 2010 3:01:00
AM GMT)	Wrote: 1268532060000	Read: 1268535660000 Difference: 3600000
Mar 14, 2010 3:01:00 AM GMT	(Mar 13, 2010 9:01:00 PM CST)	*FAILED	-> (Mar 14, 2010 4:01:00
AM GMT)	Wrote: 1268535660000	Read: 1268539260000 Difference: 3600000
Mar 14, 2010 4:01:00 AM GMT	(Mar 13, 2010 10:01:00 PM CST)	*FAILED	-> (Mar 14, 2010 5:01:00
AM GMT)	Wrote: 1268539260000	Read: 1268542860000 Difference: 3600000
Mar 14, 2010 5:01:00 AM GMT	(Mar 13, 2010 11:01:00 PM CST)	*FAILED	-> (Mar 14, 2010 6:01:00
AM GMT)	Wrote: 1268542860000	Read: 1268546460000 Difference: 3600000
Mar 14, 2010 6:01:00 AM GMT	(Mar 14, 2010 12:01:00 AM CST)	*FAILED	-> (Mar 14, 2010 7:01:00
AM GMT)	Wrote: 1268546460000	Read: 1268550060000 Difference: 3600000
Mar 14, 2010 7:01:00 AM GMT	(Mar 14, 2010 1:01:00 AM CST)	*FAILED	-> (Mar 14, 2010 8:01:00
AM GMT)	Wrote: 1268550060000	Read: 1268553660000 Difference: 3600000
Mar 14, 2010 8:01:00 AM GMT	(Mar 14, 2010 3:01:00 AM CDT)	ok	-> (Mar 14, 2010 8:01:00 AM
GMT)	Wrote: 1268553660000	Read: 1268553660000
Mar 14, 2010 9:01:00 AM GMT	(Mar 14, 2010 4:01:00 AM CDT)	ok	-> (Mar 14, 2010 9:01:00 AM
GMT)	Wrote: 1268557260000	Read: 1268557260000
Mar 14, 2010 10:01:00 AM GMT	(Mar 14, 2010 5:01:00 AM CDT)	ok	-> (Mar 14, 2010 10:01:00
AM GMT)	Wrote: 1268560860000	Read: 1268560860000
Dropping Table...




Database Mode:   EMBEDDED
Local Time Zone: Central Standard Time
Using Embedded Driver: org.apache.derby.jdbc.EmbeddedDriver
Using Embedded URL: jdbc:derby:directory:C:\temp\dst_test_db;create=true
Dropping Table...
Creating Table...
Mar 13, 2010 10:01:00 PM GMT	(Mar 13, 2010 4:01:00 PM CST)	ok	-> (Mar 13, 2010 10:01:00
PM GMT)	Wrote: 1268517660000	Read: 1268517660000
Mar 13, 2010 11:01:00 PM GMT	(Mar 13, 2010 5:01:00 PM CST)	ok	-> (Mar 13, 2010 11:01:00
PM GMT)	Wrote: 1268521260000	Read: 1268521260000
Mar 14, 2010 12:01:00 AM GMT	(Mar 13, 2010 6:01:00 PM CST)	ok	-> (Mar 14, 2010 12:01:00
AM GMT)	Wrote: 1268524860000	Read: 1268524860000
Mar 14, 2010 1:01:00 AM GMT	(Mar 13, 2010 7:01:00 PM CST)	ok	-> (Mar 14, 2010 1:01:00 AM
GMT)	Wrote: 1268528460000	Read: 1268528460000
Mar 14, 2010 2:01:00 AM GMT	(Mar 13, 2010 8:01:00 PM CST)	ok	-> (Mar 14, 2010 2:01:00 AM
GMT)	Wrote: 1268532060000	Read: 1268532060000
Mar 14, 2010 3:01:00 AM GMT	(Mar 13, 2010 9:01:00 PM CST)	ok	-> (Mar 14, 2010 3:01:00 AM
GMT)	Wrote: 1268535660000	Read: 1268535660000
Mar 14, 2010 4:01:00 AM GMT	(Mar 13, 2010 10:01:00 PM CST)	ok	-> (Mar 14, 2010 4:01:00
AM GMT)	Wrote: 1268539260000	Read: 1268539260000
Mar 14, 2010 5:01:00 AM GMT	(Mar 13, 2010 11:01:00 PM CST)	ok	-> (Mar 14, 2010 5:01:00
AM GMT)	Wrote: 1268542860000	Read: 1268542860000
Mar 14, 2010 6:01:00 AM GMT	(Mar 14, 2010 12:01:00 AM CST)	ok	-> (Mar 14, 2010 6:01:00
AM GMT)	Wrote: 1268546460000	Read: 1268546460000
Mar 14, 2010 7:01:00 AM GMT	(Mar 14, 2010 1:01:00 AM CST)	ok	-> (Mar 14, 2010 7:01:00 AM
GMT)	Wrote: 1268550060000	Read: 1268550060000
Mar 14, 2010 8:01:00 AM GMT	(Mar 14, 2010 3:01:00 AM CDT)	ok	-> (Mar 14, 2010 8:01:00 AM
GMT)	Wrote: 1268553660000	Read: 1268553660000
Mar 14, 2010 9:01:00 AM GMT	(Mar 14, 2010 4:01:00 AM CDT)	ok	-> (Mar 14, 2010 9:01:00 AM
GMT)	Wrote: 1268557260000	Read: 1268557260000
Mar 14, 2010 10:01:00 AM GMT	(Mar 14, 2010 5:01:00 AM CDT)	ok	-> (Mar 14, 2010 10:01:00
AM GMT)	Wrote: 1268560860000	Read: 1268560860000
Dropping Table...



> Timestamps inserted with GMT calendar are 1 hour later when subsequently read with GMT
calendar (Server Mode Only).
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4582
>                 URL: https://issues.apache.org/jira/browse/DERBY-4582
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.5.3.0
>         Environment: Windows XP Professional Version 2002 Service Pack 3,  Central Standard
Time Zone (America/Chicago)
>            Reporter: Keith Kruse
>         Attachments: DerbyTest.java
>
>
> This issue only appears to happen in Network Server/Client mode.  Embedded mode does
not have the issue.
> My timezone is American/Chicago.  Saving timestamps with values for the 6 hours prior
to DST start are being read back in as values 1 hour later than written.  (I believe the issue
happens on the write because values written in Network Server/Client mode and read in Embedded
mode are incorrect, while values written and read in Embedded mode are corect.)
> Values between 3/13/2010 - 20:00 CST and 3/14/2010 - 02:00 CST will return timstamps
1 hour off.  The "setTimestamp" method is being passed a GMT calendar with the timestamp:
> I have a complete test class I can attach, but here is a summary:
> private final TimeZone gmtTZ = TimeZone.getTimeZone("GMT");
> private final Calendar gmtCal = Calendar.getInstance(gmtTZ);
> ...
> String sql = "INSERT INTO app.dst_test (id, gmt_timestamp, milli_time) VALUES(?,?,?)";
> String sql2 = "SELECT * from app.dst_test where id=?";
> ...
> ps.setTimestamp(2, ts, gmtCal);
> ...
> Timestamp tsRead = rs.getTimestamp("gmt_timestamp", gmtCal);
> ...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message