使用springboot最新版本mysql-Connector连接数据库时提示Loading class `com.mysql.jdbc.Driver'. This is deprecated.

在连接数据库时,使用了最新版本的mysql-Connector,即6.0以上版本

1、报错如下:

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

解决方法:

将 jdbc.driverClassName=com.mysql.jdbc.Driver 修改为

jdbc.driverClassName=com.mysql.cj.jdbc.Driver

2、报错如下:

com.mysql.cj.exceptions.InvalidConnectionAttributeException: 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.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_60]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_60]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_60]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_60]

解决方式:

在jdbc连接url中加入属性serverTimezone,即需要指定时区。例如:

jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=gbk&useSSL=true

&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Hongkong  

serverTimezone只是扩展:

  1、选择东8区的Hongkong、Asia/Shanghai或者Asia/Hongkong作为参数

  2、serverTimezone=GMT%2B8表示北京时间

使用springboot最新版本mysql-Connector连接数据库时提示Loading class `com.mysql.jdbc.Driver'. This is deprecated.

原文地址:https://www.cnblogs.com/kingsonfu/p/10344483.html

时间: 2024-08-01 21:17:04

使用springboot最新版本mysql-Connector连接数据库时提示Loading class `com.mysql.jdbc.Driver'. This is deprecated.的相关文章

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'.

在连接数据库时,使用了最新版本的mysql-Connector,所以导致老版本的"com.mysql.jdbc.Drive"不可行,要改为"com.mysql.cj.jdbc.Driver" Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. 原文地址:https://www.cnblogs.com

mysql 问题 Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdb

异常错误:Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. 这个问题 是在我整合项目过程中出现的

解决Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'.

异常: Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. 整合spring boot项目过程中出现的,用了最新的mysql 连接驱动 application-dev.properties spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimezone=

JSP Tomcat8.0运行连接池时发生异常【AbstractMethodError oracle.jdbc.driver.T4CConnection.isValid(I)Z】

原创 2015年12月28日 11:38:01 2004 一.Tomcat8.0运行连接池时发生异常: AbstractMethodError oracle.jdbc.driver.T4CConnection.isValid(I)Z 二.如何解决 由于驱动包引起的:原先是用的Oracle 10g 10.2.0.2 JDBC_ojdbc14.jar 但现在必须换成: ojdbc6.jar   即OK! 注意: Tomcat8+JDK1.7+Ojdbc6.jar Oracle驱动包

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

简单介绍 声明:使用JDK9.MYSQL8.idea 报错处理 报错信息如下 原因 提示信息表明数据库驱动com.mysql.jdbc.Driver已经被弃用了.应当使用新的驱动com.mysql.cj.jdbc.Driver Loading class `com.mysql.jdbc.Driver'. This is deprecated. The driver is automatically registered via the SPI and manual loading of the

解决4.4版本以上剪裁图片时提示无法加载图片的问题

/** * 将uri转换成字符串 * 解决4.4版本以上获取到的uri是图片名称而非图片路径,导致剪裁图片时提示无法加载图片的问题 * 详细的解决方案,请参考这篇文章 * 当安卓的版本比较高时(如4.4),选择本地相册可能会返回“无法加载此图片” * 原因:正常uri是file://...而高版本是content://... * 所以需要一个转换操作 * * @param context * @param uri * @return */ @SuppressLint("NewApi")

apache+php+mysql环境搭建时,phpinfo里面没有mysql解决办法

1.extension=php_mysql.dll,先加入mysql扩展. 2.php.ini中extension_dir必须是绝对路径. 3.php文件夹下的libmysql.dll文件复制到C:\Windows\System32文件夹下. 4.php.ini复制到C:\Windows文件夹下.

MySQL导出数据时提示文件损坏

使用Navicat工具,优先将整个数据库的表和数据导出. 如果遇到文件损坏错误可以在表实例界面选中所有表,然后将表转储为SQL文件(结构和数据). 在目标数据库执行导出的SQL文件,导入数据和结构. 如果个别表因为各种原因(比如使用federated引擎建立了DB-LINK)引起导入失败,可以重新导出,只是导出过程排除那些出问题的表,对于出问题的表可以单独复制结构和数据. 原文地址:https://www.cnblogs.com/JaxYoun/p/12336959.html

巧用ajax请求服务器加载数据列表时提示loading

我们利用weui.js中的weui.loading为效果,ajax的beforeSend与complete方法,做一个加载数据时会有几秒的 loading... 要在页面需要加载的JS文件: <script src="../js/libs/weui.min.js"></script> 可以去weui的文档中下载,这是它的demo:   https://weui.io/weui.js/ 这里主要讲jQuery ajax的get,查询数据时,它的结构为: $.aja