Bug #93444 | LocalDateTime parameter values altered when client and server timezones differ | ||
---|---|---|---|
Submitted: | 2 Dec 2018 16:56 | Modified: | 25 Sep 2020 21:33 |
Reporter: | Gord Thompson | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S3 (Non-critical) |
Version: | 8.0.13 | OS: | Any |
Assigned to: | Filipe Silva | CPU Architecture: | Any |
[2 Dec 2018 16:56]
Gord Thompson
[4 Dec 2018 13:06]
Filipe Silva
Hi Gord, Thank you for your interest in MySQL and Connector/J. You're right, this is a bug and should be fixed.
[6 Feb 2019 13:19]
Sam Price
This affects all Local* classes in the JDK. Any chance we could have a fix in 8.0.16, please? :) I'm happy to contribute a patch.
[20 May 2019 17:42]
OCA Admin
Contribution submitted via Github - Fix for #93444 - improve setObject behavior for LocalDate, LocalDateTime and Loc (*) Contribution by 巖 阿部 (Github harawata, mysql-connector-j/pull/36): This PR is an attempt to fix [#93444](https://bugs.mysql.com/bug.php?id=93444). i.e. - Inserted `LocalDate`, `LocalDateTime` and `LocalTime` values are altered when there is timezone difference between server and client. The basic idea is to eliminate involvement of the legacy date/time classes (e.g. `java.sql.Timestamp`, `java.util.Calendar`) during the process. Some notes: - On my environment, there is no new test failure caused by this change. - Commented-out lines in `StatementTest` are seemingly unsupported conversions. I left them for you to confirm that they all are expected. - I have sent my signed OCA a few days ago. - I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it. If there is anything you want me to change or clarify, please let me know.
Contribution: git_patch_280113759.txt (text/plain), 35.05 KiB.
[28 Oct 2019 14:09]
Gareth Smith
This is still an issue. Please can the fix be included in a new release of mysql-connector-java ?
[30 Jan 2020 9:10]
Ruslan Stelmachenko
It's still relevant. It's also related to #98436 (same problem, but with LocalDate).
[13 Feb 2020 14:00]
Alexander Soklakov
Bug#98468 is marked as a duplicate of this one.
[13 Feb 2020 14:18]
Alexander Soklakov
Bug#97240 is marked as a duplicate of this one.
[13 Feb 2020 15:42]
Alexander Soklakov
Bug#96276 is marked as a duplicate of this one.
[25 Sep 2020 21:33]
Daniel So
Posted by developer: Added the following entry to the Connector/J 8.0.22 changelog: "LocalDate, LocalDateTime, and LocalTime values set through Connector/J were altered when there was a timezone difference between the server and the client. This fix corrects the issue by handling the LocalDate, LocalTime, and LocalDateTime with no time zone conversion and no intermediate conversions to other date-time classes. Thanks to Iwao Abe for his contribution to the fix."
[20 Oct 2020 6:52]
Frederic Descamps
Thank you for your contribution that has been added to 8.0.22: https://lefred.be/content/mysql-8-0-22-thank-you-for-the-contributions/
[3 Sep 2021 11:37]
Vojtech Knyttl
The problem with this still persists for me when using LocalDate (version 8.0.26). I created a new issue for this: https://bugs.mysql.com/bug.php?id=104822&thanks=4
[19 Feb 2022 14:30]
Roman Zinchuk
I have the same bug, but with LocalDateTime. I pass "2022-02-14 00:00" as query param in java, but got "2022-02-13 22:00" in query. i'm using mysql-connector-java:8.0.27