Young87

SmartCat's Blog

So happy to code my life!

游戏开发交流QQ群号60398951

当前位置:首页 >跨站数据

jdbc连接数据库可能遇到的问题

1.Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.jdbc.Driver’. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

解决办法:
将com.mysql.jdbc.Driver 改为 com.mysql.cj.jdbc.Driver即可。

//1.注册驱动
			 Class.forName("com.mysql.cj.jdbc.Driver");

2.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.
时区错误
解决办法://2.获取数据库连接对象—登录 选择数据库的过程
添加代码 ?serverTimezone=UTC

//2.获取数据库连接对象---登录 选择数据库的过程
conn = DriverManager.getConnection
("jdbc:mysql://localhost:3306/sys?serverTimezone=UTC", "root", "123456");

除特别声明,本站所有文章均为原创,如需转载请以超级链接形式注明出处:SmartCat's Blog

上一篇: CIKM 2020 | 一文详解美团6篇精选论文

下一篇: 巨杉数据库v5.0携手迪思杰深化战略级合作

精华推荐