Notes on matching MySql 8.0 and corresponding driver packages

Notes on matching MySql 8.0 and corresponding driver packages

MySql 8.0 corresponding driver package matching

After the MySql database is updated to version 8.0 or above, the corresponding application database link driver package must also be updated to version 8.0. Otherwise, a driver exception will be reported.

A few points to note:

1. The latest driver package Maven download configuration is as follows:

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.11</version>
</dependency>

2. The JDBC configuration table is updated as follows:

Previous Versions

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://xxx.xx.xx.xxx:3306/db?characterEncoding=utf-8
jdbc.username=root
jdbc.password=admin

Current version

  • jdbc.driver = com.mysql.cj.jdbc.Driver
  • jdbc.url=jdbc:mysql://xxx.xx.xx.xxx:3306/db? useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
  • jdbc.username=root
  • jdbc.password=ad

Pay attention to the red part, this is where the changes need to be made. After that, you can use the 8.0 version of MySql.

MySql 8.0 version driver replacement

The driver of MySQL 8.0 needs to be changed to "com.mysql.cj.jdbc.Driver". The previous "com.mysql.jdbc.Driver" can no longer be used in MySQL 8.0. The official document link is: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-api-changes.html;

In addition, it is recommended to update mysql-connector-java to version 8.0 (https://dev.mysql.com/downloads/connector/j/).

In summary, the following two points are modified:

1. Update the mysql-connector-java version:

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
</dependency>

2. Replace the driver:

<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3306/test?
useUnicode=true&amp;characterEncoding=utf-8&amp;useSSL=false" userId="root" password="root"/>

The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • WebLogic cluster and configuration graphic method
  • A simple example of connecting to Oracle/MySQL database using Java [with Oracle+MySQL database driver package]
  • WebLogic service establishes data source connection test and updates MySQL driver package

<<:  Detailed explanation of inline-block layout implementation of CSS display attribute

>>:  Introduction to the use of html area image hotspots with a list of related properties

Recommend

Vue custom v-has instruction to implement button permission judgment

Application Scenario Taking the background manage...

In-depth understanding of the use of Vue

Table of contents Understand the core concept of ...

Solution to running out of MySQL's auto-increment ID (primary key)

There are many types of auto-increment IDs used i...

web.config (IIS) and .htaccess (Apache) configuration

xml <?xml version="1.0" encoding=&qu...

Detailed explanation of MySQL date string timestamp conversion

The conversion between time, string and timestamp...

Basic usage of find_in_set function in mysql

Preface This is a new function I came across rece...

Windows 10 is too difficult to use. How to customize your Ubuntu?

Author | Editor Awen | Produced by Tu Min | CSDN ...

What you need to know about msyql transaction isolation

What is a transaction? A transaction is a logical...

How to operate MySQL database with ORM model framework

What is ORM? ORM stands for Object Relational Map...

Centos7.3 How to install and deploy Nginx and configure https

Installation Environment 1. gcc installation To i...

Example code of layim integrating right-click menu in JavaScript

Table of contents 1. Effect Demonstration 2. Impl...

Database query optimization: subquery optimization

1. Case Take all employees who are not the head o...