Bug #55398 wrong default calendar in setTimestamp in PreparedStatement
Submitted: 20 Jul 2010 13:13 Modified: 20 Jul 2010 13:53
Reporter: Roman Bednarek Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:1.5.6 OS:Any
Assigned to: Alexander Soklakov CPU Architecture:Any
Tags: PreparedStatement, timestamp

[20 Jul 2010 13:13] Roman Bednarek
Description:
Function setTimestamp in PreparedStatement uses server timezone instead of jvm default when calendar parameter is ommited. With new time handling option useLegacyDatetimeCode=false.
Cite from docs "If no Calendar object is specified, the driver uses the default timezone, which is that of the virtual machine running the application."

How to repeat:
see testcase
[20 Jul 2010 13:14] Roman Bednarek
sql to create table for testcase

Attachment: bug55398.sql (application/octet-stream, text), 107 bytes.

[20 Jul 2010 13:15] Roman Bednarek
simple testcase

Attachment: bug55398.java (text/x-java-source), 1.61 KiB.

[20 Jul 2010 13:25] Tonci Grgin
Roman, what happens with useServerPrepStmts=true?
[20 Jul 2010 13:32] Roman Bednarek
With useServerPrepStmts=true, the result is different. 
all three result are the same:

with utc calendar:
2010-07-01 02:00:00.0
with local calendar:
2010-07-01 02:00:00.0
without calendar:
2010-07-01 02:00:00.0

without useServerPrepStmts=true:

with utc calendar:
2010-07-01 02:00:00.0
with local calendar:
without calendar:
2010-07-01 02:00:00.0

and according to documentation it should be:
with utc calendar:
2010-07-01 02:00:00.0
with local calendar:
without calendar:
[20 Jul 2010 13:53] Tonci Grgin
Roman, the two types of PSTMT should operate the same so this is a bug.
[25 Apr 2013 8:34] Alexander Soklakov
Bug#68063 is duplicate of this one, reporting different behavior of CSPS and SSPS.