What are the considerations for upgrading to mysql-connector-java8.0.27
This article is about upgrading to mysql-connector-java8.0.27 to share with you what points for attention, the editor thinks it is very practical, so share with you to learn, I hope you can learn something after reading this article, say no more, follow the editor to have a look.
Recently, online security scanned a loophole in the mysql connector and took a look at the 5.1.47 version. It has been quite a long time indeed.
The recommendation is to upgrade to the latest version of 8.0.27
There will always be some problems with the upgrade, and the deployment was reported wrong after changing the connector.
# Error querying database. Cause: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
I can't connect to the database.
Looking up the configuration file found that the classes for connection pooling configuration connections were not found.
After switching back to mysql-connector-java 5.1.47, this class can be found.
Looking at the source code of jar package, it is found that the path of the class connected to jdbc has been changed after changing mysql-connector-java 8.0.27, Tai Keng.
Finally, just change it to com.mysql.cj.jdbc.MysqlDataSource.
Finally, the database connection configuration of mysql8.0+ is attached.
Jdbc.driverClassName=com.mysql.cj.jdbc.Driver
Jdbc.url=jdbc:mysql://*?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
The rest of the framework is configured as
4.3.29.RELEASE
3.4.0
1.3.0
These are the points for attention in upgrading to mysql-connector-java8.0.27, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.