Notes on upgrading to mysql-connector-java8.0.27

Notes on upgrading to mysql-connector-java8.0.27

Recently, an online security scan found a vulnerability in the MySQL connector. I checked and found that the version used was 5.1.47, which is indeed a long time ago.

It is recommended to upgrade to the latest version 8.0.27

There are always some problems with upgrades. After changing the connector, the deployment reported an error.

### Error querying database. Cause: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource

Can't connect to the database

I searched the configuration file and found that the class for the connection pool configuration connection could not be found.

After switching back to mysql-connector-java 5.1.47, this class can be found

Checking the jar package source code, I found that after changing mysql-connector-java 8.0.27, the path of the class connecting to jdbc has changed, which is a big pit.

Finally, just change it to com.mysql.cj.jdbc.MysqlDataSource

Finally, attach the database connection configuration of mysql8.0+

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 configuration is

<spring_version>4.3.29.RELEASE</spring_version>

<mybatis_version>3.4.0</mybatis_version>

<mybatis_spring_version>1.3.0</mybatis_spring_version>

This is the end of this article about the precautions for upgrading to mysql-connector-java8.0.27. For more information about mysql-connector-java8.0.27, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • MySQL 8.0.27 installation and configuration method graphic tutorial (Windows 64 bit)
  • mysql8.0.27 configuration steps and precautions
  • Detailed steps to install MySQL 8.0.27 in Linux 7.6 binary
  • MySQL 8.0.28 installation and uninstallation tutorial in Ubuntu 20
  • Ubuntu MySQL 8.0.28 installation and configuration method graphic tutorial
  • Windows free installation MySQL 8.0.28 version graphic tutorial
  • mysql 8.0.28 winx64.zip installation and configuration method graphic tutorial
  • MySQL 8.0.28 installation and configuration tutorial under Windows
  • MySQL 8.0.28 installation and configuration method graphic tutorial
  • MySQL 8.0.27 installation and configuration method graphic tutorial under Windows

<<:  How to understand the difference between ref toRef and toRefs in Vue3

>>:  Solution to overflow of html table

Recommend

CSS Tutorial: CSS Attribute Media Type

One of the most important features of a style she...

How to limit the number of records in a table in MySQL

Table of contents 1. Trigger Solution 2. Partitio...

Common problems in implementing the progress bar function of vue Nprogress

NProgress is the progress bar that appears at the...

Detailed explanation of built-in methods of javascript array

Table of contents 1. Array.at() 2. Array.copyWith...

What codes should I master when learning web page design?

This article introduces in detail some of the tech...

How to install MySQL database on Ubuntu

Ubuntu is a free and open source desktop PC opera...

How to introduce Excel table plug-in into Vue

This article shares the specific code of Vue intr...

How to enter and exit the Docker container

1 Start the Docker service First you need to know...

What is web design

<br />Original article: http://www.alistapar...

Detailed explanation of how to configure static IP in Centos8

After installing centos 8, the following error wi...

VMware installation of Centos8 system tutorial diagram (Chinese graphical mode)

Table of contents 1. Software and system image 2....

Solutions to MySQL OOM (memory overflow)

OOM stands for "Out Of Memory", which m...

CentOS IP connection network implementation process diagram

1. Log in to the system and enter the directory: ...