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

Detailed explanation of this pointing problem in JavaScript function

this keyword Which object calls the function, and...

Detailed explanation of how Tomcat implements asynchronous Servlet

Preface Through my previous Tomcat series of arti...

Sample code for html list box, text field, and file field

Drop-down box, text field, file field The upper p...

Problem analysis of using idea to build springboot initializer server

Problem Description Recently, when I was building...

HTML table markup tutorial (9): cell spacing attribute CELLSPACING

A certain distance can be set between cells in a ...

MySQL 8.0.13 installation and configuration method graphic tutorial

This article shares the installation and configur...

The concrete implementation of JavaScript exclusive thinking

In the previous blog, Xiao Xiong updated the meth...

How to implement html input drop-down menu

Copy code The code is as follows: <html> &l...

Detailed explanation of Vue custom instructions

Table of contents Vue custom directive Custom dir...

mysql5.7.20 installation and configuration method graphic tutorial (mac)

MySQL 5.7.20 installation and configuration metho...

Getting Started Tutorial on Animating SVG Path Strokes Using CSS3

Without relying on JavaScript, pure CSS is used t...

Detailed explanation of the initialization mechanism in bash

Bash Initialization Files Interactive login shell...

In-depth explanation of the locking mechanism in MySQL InnoDB

Written in front A database is essentially a shar...