jira icon indicating copy to clipboard operation
jira copied to clipboard

MySQL Connector/J8.0.22有时区BUG

Open KoalaJas opened this issue 11 months ago • 1 comments

这两天升级到了8.0.33,发现存量的工单、confluence文章附件时间等都减了13小时,搜索一番发现是JDBC和Mysql协商CST是否会混乱。 看了mysql官网发现这个bug在8.0.23修复了: https://dev.mysql.com/doc/relnotes/connector-j/8.0/en/news-8-0-23.html

After upgrading from Connector/J 5.1 to 8.0, the results of saving and then retrieving and values became different sometimes. It was because while Connector/J 5.1 does not preserve a time instant by default, Connector/J 8.0.22 and earlier tried to do so by converting a timestamp to the server's session time zone before sending its value to the server. In this release, new mechanisms for controlling timezone conversion has been introduced—see Preserving Time Instants for details. Under this new mechanism, the default behavior of Connector/J 5.1 in this respect is preserved by setting the connection property preserveInstants=false. (Bug #30962953, Bug #98695, Bug #30573281, Bug #95644)DATETIMETIMESTAMP

测试了两种解决方法:要不然就升级JDBC,要不然就要在docker-compose.yml里添加参数--default-time-zone = '+08:00' @haxqer

KoalaJas avatar Mar 14 '24 15:03 KoalaJas

m.....d 这周六还要加班,我只能这周日试试你给出的方案了

感谢你

haxqer avatar Mar 20 '24 11:03 haxqer