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

Using streaming queries in MySQL to avoid data OOM

Table of contents 1. Introduction 2. JDBC impleme...

How to use react-color to implement the front-end color picker

background We can use react-color to implement th...

VMware vCenter 6.7 installation process (graphic tutorial)

background I originally wanted to download a 6.7 ...

Centos7 installation of MySQL8 tutorial

MySQL 8 new features: My personal opinion on MySQ...

This article will show you how to use Vue 3.0 responsive

Table of contents Use Cases Reactive API related ...

Detailed Introduction to Nginx Installation and Configuration Rules

Table of contents 1. Installation and operation o...

How to use dynamic parameters and calculated properties in Vue

1. Dynamic parameters Starting from 2.6.0, you ca...

Detailed explanation of jquery tag selector application example

This article example shares the specific code of ...

Example of how to set up a Linux system to automatically run a script at startup

Preface Hello everyone, I am Liang Xu. At work, w...

CSS XTHML writing standards and common problems summary (page optimization)

Project Documentation Directory Div+CSS Naming Sta...

Docker installs ClickHouse and initializes data testing

Clickhouse Introduction ClickHouse is a column-or...

Perfect solution for vertical centering of form elements

Copy code The code is as follows: <!DOCTYPE ht...

MySQL chooses the right storage engine

When it comes to databases, one of the most frequ...

A brief discussion on JavaScript scope

Table of contents 1. Scope 1. Global scope 2. Loc...

A guide to writing flexible, stable, high-quality HTML and CSS code standards

The Golden Rule Always follow the same set of cod...