码迷,mamicode.com
首页 > 其他好文 > 详细

MyBatis 多数据源

时间:2020-02-15 11:42:54      阅读:52      评论:0      收藏:0      [点我收藏+]

标签:repr   zone   timezone   drive   src   ffffff   The   http   mybatis   

序言:在练习Spring Boot + MyBatis多数据源项目时,遇到 ERROR 16856 --- [reate-876365377] com.alibaba.druid.pool.DruidDataSource   : create connection SQLException, url: jdbc:mysql:///chapter05-1, errorCode 0, state 01S00, java.sql.SQLException: The server time zone value ‘?й???????‘ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the ‘serverTimezone‘ configuration property) to use a more specifc time zone value if you want to utilize time zone support.问题;

问题描述:1. 控制台界面:

技术图片

 

 2. 经过仔细的排查,是MySQL本身的时区设置问题导致的。MySQL安装默认时区为美国时区,而北京比美国迟8个小时。

3. IntelliJ IDEA中application.propertis的数据库连接配置信息如下:

技术图片

 

4. 解决方案:在 spring.datasource.one.url 与 spring.datasource.two.url 的后面加 serverTimezone=UTC

技术图片

 

 

 

 

 

 

 

 

 

 

 

 

MyBatis 多数据源

标签:repr   zone   timezone   drive   src   ffffff   The   http   mybatis   

原文地址:https://www.cnblogs.com/maxge/p/12310927.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!