Bug #24344 useServerPrepStmts impacts time zone calculations
Submitted: 15 Nov 2006 20:38 Modified: 22 Feb 2007 15:07
Reporter: Todd Farmer
Status: Closed
Category:Connector/J Severity:S2 (Serious)
Version:5.0.4 OS:
Assigned to: Target Version:
Tags: time zone, useServerPrepStmts, useJDBCCompliantTimezoneShift

[15 Nov 2006 20:38] Todd Farmer
Description:
Connector/J is shifting DATETIME fields in prepared statements by the timezone offset (to
GMT) when the connection with useServerPrepStmts=true.  When the connection is established
with userServerPrepStmts=false, this shifting does not occur.  This causes different
results dependent on the setting of useServerPrepStmts.

How to repeat:
See attached test case.

1.  Create a Calendar object.
2.  Establish a Connection with useServerPrepStmts=true.
3.  Use a PreparedStatement to insert the Calendar object into a table.
4.  Establish a Connection with useServerPrepStmts=false.
5.  Use a PreparedStatement to insert the Calendar object into a table.
6.  Compare the values inserted in steps 3 and 5 - they will be different by the time zone
offset.

Suggested fix:
Correct behavior of of PreparedStatements so they are independent of the setting of
useServerPrepStmts.
[6 Dec 2006 22:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/16553
[22 Feb 2007 15:07] MC Brown
A note has been added to the 5.0.5 changelog.