JDBC连接mysql8报错
发布日期:2021-10-06 15:05:14
浏览次数:10
分类:技术文章
本文共 901 字,大约阅读时间需要 3 分钟。
问题:org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is 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.
Caused by: 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.
**原因:**因使用的mysql版本为新版,连接参数需要加上时区
**解决:**新版的mysql驱动类更新成了com.mysql.cj.jdbc.Driver
连接的时候也需要注意时区的问题,在url的连接参数上设置时区即可:我这里设置的是北京时区
url: jdbc:mysql:///test01?serverTimezone=GMT%2B8
转载地址:https://blog.csdn.net/m0_37815017/article/details/102534539 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
第一次来,支持一个
[***.219.124.196]2024年04月21日 03时37分30秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
我的微信公众号
2019-04-28
C++对象的复制操作
2019-04-28
C++自定义拷贝构造函数
2019-04-28
C++拷贝构造函数的几点特性
2019-04-28
C++静态成员变量的定义
2019-04-28
C++静态成员变量初始化
2019-04-28
C++静态成员变量在内存中的存储方式
2019-04-28
普通程序员与优秀程序员
2019-04-28
Android Binder框架不谈代码
2019-04-28
二进制数据 C 代码解析数据表示
2019-04-28
Linux C/C++ 零基础学习编程教程,Linux 系统编程教程
2019-04-28
搭建 Linux C 编程环境 --- 安装 Ubuntu 系统(2)
2019-04-28
搭建 Linux C 编程环境 --- 安装VMware虚拟机(1)
2019-04-28
搭建 Linux C 编程环境 --- 使用配置好的Ubuntu系统1
2019-04-28
搭建 Linux C 编程环境 --- 使用配置好的Ubuntu系统2
2019-04-28
linux项目 -- 图书管理系统(链表版)
2019-04-28
linux项目 --- 图书管理系统(数据库版)
2019-04-28
airplay协议开发第1部(搭建测试环境)
2019-04-28
airplay协议开发第2部(介绍接口、视频、音频的操作)
2019-04-28
airplay协议开发第3部(mdnsd注册airplay服务)
2019-04-28