简体   繁体   English

java.sql.SQLException: 未知的系统变量 'tx_isolation'

[英]java.sql.SQLException: Unknown system variable 'tx_isolation'

I am using play framework and I want to connect db, but I can't because I am getting following error:我正在使用播放框架,我想连接数据库,但我不能,因为我收到以下错误:

play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]]
Caused by: play.api.Configuration$$anon$1: Configuration error[Failed to initialize pool: Unknown system variable 'tx_isolation']
Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Unknown system variable 'tx_isolation' java.sql.SQLException: Unknown system variable 'tx_isolation

I tried to find tx_isolation , but it doesn't exist:我试图找到tx_isolation ,但它不存在:

mysql> show variables like 'tx_isolation';
Empty set (0.00 sec)

So what is and how can I find tx_isolation ?那么什么是以及如何找到tx_isolation


Sorry.对不起。 this is my error code.这是我的错误代码。 and I use mysql 8.0.11.我使用 mysql 8.0.11。 so i find 'transaction_isolation'所以我找到了“transaction_isolation”

play.db {
  config = "db"
  default = "default"
}
db {
//TODO : 작업필요
  default.driver = com.mysql.jdbc.Driver
  default.url = "jdbc:mysql://127.0.0.1:3306/testPlayDB"
  default.username = root
  default.password = "321A@654"
}

Error cause Default.url = "jdbc:mysql://127.0.0.1:3306/testPlayDB"错误原因 Default.url = "jdbc:mysql://127.0.0.1:3306/testPlayDB"

i use Scala, playframework and StackOverflow first time...我第一次使用 Scala、playframework 和 StackOverflow...

Thank you.谢谢你。

If you are using MYSQL8, try to show variables like 'transaction_isolation' .如果您使用的是 MYSQL8,请尝试show variables like 'transaction_isolation' Mysql8 has renamed tx_isolation to transaction_isolation . Mysql8 已将 tx_isolation 重tx_isolationtransaction_isolation

I had a same problem.我有同样的问题。 I upgraded my MySql Connector and solved my issue.我升级了 MySql 连接器并解决了我的问题。 try to use version 8 , like this:尝试使用版本 8 ,如下所示:

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

我也遇到了同样的错误(当我在 mysql5 中使用 mysql6 数据库时它工作正常)然后我将连接器 jar 从mysql-connector-java-5.1.46.jarmysql.jar然后问题消失了。

You have a mismatch between client lib version and server version.客户端库版本和服务器版本不匹配。

Here are the version numbers where things change:以下是发生变化的版本号:

mysql-connector-java-8.0.8 release notes mysql-connector-java-8.0.8 发行说明

Important Change: Following the changes in MySQL Server 8.0.3, the system variables tx_isolation and tx_read_only have been replaced with transaction_isolation and transaction_read_only in the code of Connector/J.重要变化:随着 MySQL Server 8.0.3 的变化,Connector/J 的代码中系统变量 tx_isolation 和 tx_read_only 被替换为 transaction_isolation 和 transaction_read_only。 Users should update Connector/J to this latest release in order to connect to MySQL 8.0.3.用户应将 Connector/J 更新到此最新版本以连接到 MySQL 8.0.3。 They should also make the same adjustments to their own applications if they use the old variables in their codes.如果他们在代码中使用旧变量,他们也应该对自己的应用程序进行相同的调整。 (Bug #26440544) (错误#26440544)

mysql server 5.7.20 release notes mysql 服务器 5.7.20 发行说明

Previously, the --transaction-isolation and --transaction-read-only server startup options corresponded to the tx_isolation and tx_read_only system variables.以前,--transaction-isolation 和--transaction-read-only 服务器启动选项对应于 tx_isolation 和 tx_read_only 系统变量。 For better name correspondence between startup option and system variable names, transaction_isolation and transaction_read_only have been created as aliases for tx_isolation and tx_read_only.为了更好地对应启动选项和系统变量名,transaction_isolation 和 transaction_read_only 被创建为 tx_isolation 和 tx_read_only 的别名。 The tx_isolation and tx_read_only variables are now deprecated and will be removed in MySQL 8.0. tx_isolation 和 tx_read_only 变量现在已弃用,将在 MySQL 8.0 中删除。 Applications should be adjusted to use transaction_isolation and transaction_read_only instead.应调整应用程序以改用 transaction_isolation 和 transaction_read_only。

mysql server 8.0.3 release notes mysql 服务器 8.0.3 发行说明

The deprecated tx_isolation and tx_read_only system variables have been removed.已弃用的 tx_isolation 和 tx_read_only 系统变量已被删除。 Use transaction_isolation and transaction_read_only instead.请改用 transaction_isolation 和 transaction_read_only。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM