Home > database >  Mysql version 8.0.20 JDBC
Mysql version 8.0.20 JDBC

Time:10-11

* I hid the related data
Public class DbUtil {

Public static final String URL="JDBC: mysql://*. *. *. * : */test? UseUnicode=true& CharacterEncoding=utf-8 & amp; UseJDBCCompliantTimezoneShift=true& UseLegacyDatetimeCode=false& ServerTimezone=UTC ";
Public static final String USER="*";
Public static final String PASSWORD="*";

Public static void main (String [] args) throws the Exception {
Class.forname (". Com. Mysql. Cj. JDBC Driver ");
The Connection conn=DriverManager. GetConnection (URL, USER, PASSWORD);
The Statement STMT=conn. CreateStatement ();
The ResultSet rs=STMT. ExecuteQuery (" SELECT * FROM the user ");
While (rs), next ()) {
System. The out. Println (rs. Get string (" id ") + "name:" + rs. Get int (" name "));
}
}
}
Pom
<? The XML version="1.0" encoding="utf-8"?>
XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" & gt;
4.0.0 & lt;/modelVersion>

Test
Test
1.0 - SNAPSHOT


Mysql
Mysql connector - java
8.0.20 & lt;/version>




The database version of
Mysql> Select the version ();
+ -- -- -- -- -- -- -- -- -- -- - +
(1) | | version
+ -- -- -- -- -- -- -- -- -- -- - +
| 8.0.20 |
+ -- -- -- -- -- -- -- -- -- -- - +
1 row in the set (0.37 SEC)

Mysql>


Run incredibly error
The Exception in the thread "main" Java. SQL. SQLException: Unknown system variable 'query_cache_size'
At com. Mysql. Cj. JDBC. Exceptions. SQLError. CreateSQLException (SQLError. Java: 129)
At com. Mysql. Cj. JDBC. Exceptions. SQLError. CreateSQLException (SQLError. Java: 97)

CodePudding user response:

1. Mysql - connecter - Java version is too low, is obviously database drivers don't correspond with the database version
2. The query cache is removed after Mysql 8.0

CodePudding user response:

The
reference 1/f, cloud fly me reply:
1. Mysql - connecter - Java version is too low, is obviously database driver and database version does not correspond to
2. The query cache is removed after Mysql 8.0

You answer is not correct, see that is introduced by the driver

CodePudding user response:

The initial cause of the speculation may be the result of the mysql USES proxysql?
  • Related