Calendar timezone is ignored
----------------------------
Key: SEQUOIA-989
URL: https://forge.continuent.org/jira/browse/SEQUOIA-989
Project: Sequoia
Type: Bug
Components: JDBC Driver
Versions: sequoia 2.10.10
Environment: Sequoia CVS source code.
PostgreSQL.
Reporter: Ivo Danihelka
Priority: Minor
JDBC allows to tell the driver what TimeZone to use when storing or restoring
Date values from database.
This is done by passing Calendar as extra argument into ResultSet,
PreparedStatement and CallableStatement methods.
Sequoia ignores the passed Calendar and its time zone.
For example, this should store Timestamp with UTC values:
Calendar utcCal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
preparedStatement.setTimestamp(index, new Timestamp(), utcCal);
The calendar should be passed to database driver.
PostgreSQL driver uses the calendar to convert Date into String (yyyy-MM-dd
HH:mm:ss).
That means the calendar time zone is important to produce timestamp in
requested time zone.
Current Sequoia setTimestamp(i, t, cal) code does this:
cal.setTime(t);
setTimestamp(i, new java.sql.Timestamp(cal.getTime().getTime()));
It is equivalent to:
setTimestamp(i, new java.sql.Timestamp(new Date(t.getTime()).getTime()));
So the Calendar time zone is completely ignored.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://forge.continuent.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
_______________________________________________
Sequoia mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/sequoia