Bug #109025 | Zero-based values in Date fields in Java Connector version 8.X throws exception | ||
---|---|---|---|
Submitted: | 8 Nov 2022 11:38 | Modified: | 16 Jan 2023 13:54 |
Reporter: | Ivan Kucher | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | 8.X, 8.0.31 | OS: | MacOS |
Assigned to: | CPU Architecture: | Any |
[8 Nov 2022 11:38]
Ivan Kucher
[8 Nov 2022 12:34]
MySQL Verification Team
Hello Ivan Kucher, Thank you for the report and feedback. regards, Umesh
[10 Jan 2023 20:16]
Filipe Silva
Posted by developer: This is a behavior we definitely don't want to replicate anymore. It makes no sense to return date values to the client application when the ones stored in the database are totally different, and this is not even a case of differences in Time Zone settings which could justify adjusting temporal values. It's a fact that Java does not support dates with zero values and the result was those weird shifts if we didn't use a non-lenient calendar, thus it's not possible to return such values a true Date objects, but you have to option to return the originally stored values as string (rs.getString(col)) and then work from there.
[16 Jan 2023 13:45]
Ivan Kucher
Thank you for your answer. But I still can't understand then why is it possible to have such DATE rows with zero-based values in the MySQL database and in the same time NOT possible to handle them using MySQL connector of version 8.X.
[16 Jan 2023 13:52]
Ivan Kucher
Then there is incompatibility between MySQL server and MySQL connector, since you have an option NO_ZERO_IN_DATE (https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_zero_in_date), and at the same time if I will turn off NO_ZERO_IN_DATE option, I will have an issues with the connector. So this option brakes the logic.
[16 Jan 2023 13:54]
Ivan Kucher
Absolutely the same option you still have in the MySQL connector of version 8.X https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sqlmode_no_zero_in_date