17

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:

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

So what is and how can I find tx_isolation?


Sorry. this is my error code. and I use mysql 8.0.11. so i find '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"

i use Scala, playframework and StackOverflow first time...

Thank you.

3
  • Probably duplication. What version of Database and version of driver do you use? Jun 25, 2018 at 5:50
  • 1
    Please include the Java code you are using to connect. Hard to help you based on a brief error message. Jun 25, 2018 at 5:50
  • Sorry. i using Scala with play framework, FirstTime. SO this is my ErrorCode. 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" } configuration error at default:url = "jdbc:mysql://127.0.0.1:3306/testPlayDB" code. and i use mysql 8.0.11version.
    – taehoon
    Jun 25, 2018 at 6:17

4 Answers 4

31

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

3
  • 1
    Oh. thankyou. i use mysql 8.0.11 version. i find "transaction_isolation" how can i use transaction_isolation?..
    – taehoon
    Jun 25, 2018 at 6:22
  • Try to use mysql-driver-8.* too
    – Kevinsss
    Jun 25, 2018 at 7:08
  • 1
    I am using 8.0.22 version Mysql. I am using mysql 8.0.22 java connector jar, still getting this issue.
    – Raptor0009
    Jan 31, 2021 at 12:25
17

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

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.13</version>
</dependency>
2
  • For clojurists, use this in the :dependencies map [mysql/mysql-connector-java "8.0.11"]
    – kopos
    Dec 16, 2019 at 9:49
  • Still Work with JDK. 11
    – Reza
    Feb 24, 2020 at 10:11
4

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

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. Users should update Connector/J to this latest release in order to connect to 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)

mysql server 5.7.20 release notes

Previously, the --transaction-isolation and --transaction-read-only server startup options corresponded to the tx_isolation and tx_read_only system variables. 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. The tx_isolation and tx_read_only variables are now deprecated and will be removed in MySQL 8.0. Applications should be adjusted to use transaction_isolation and transaction_read_only instead.

mysql server 8.0.3 release notes

The deprecated tx_isolation and tx_read_only system variables have been removed. Use transaction_isolation and transaction_read_only instead.

1

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.jar to mysql.jar then the problem gone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.