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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51016980/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 23:55:27  来源:igfitidea点击:

java.sql.SQLException: Unknown system variable 'tx_isolation'

javamysqldatabaseplayframework

提问by taehoon

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: Configuration error[Cannot connect to database [default]]
Caused by: play.api.Configuration$$anon: 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. so i find 'transaction_isolation'

对不起。这是我的错误代码。我使用 mysql 8.0.11。所以我找到了“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.

谢谢你。

回答by Kevinsss

If you are using MYSQL8, try to show variables like 'transaction_isolation'. Mysql8 has renamed tx_isolationto transaction_isolation.

如果您使用的是 MYSQL8,请尝试使用show variables like 'transaction_isolation'. Mysql8 已重命名tx_isolationtransaction_isolation.

回答by Ritesh Kumar

I was also getting the same error (when I am using the mysql6 database in mysql5 it was working fine) then I changed my connector jar from mysql-connector-java-5.1.46.jarto mysql.jarthen the problem gone.

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

回答by Reza

I had a same problem. I upgraded my MySql Connector and solved my issue. try to use version 8 , like this:

我有同样的问题。我升级了 MySql 连接器并解决了我的问题。尝试使用版本 8 ,如下所示:

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