警告解决 : java.sql.SQLWarning: '@@tx_isolation' is deprecated and will be removed in a future release.
程序员文章站
2022-03-23 12:29:24
...
错误信息 :
2019-07-10 09:14:50.529 INFO 21288 --- [r$PoolThread-#1] com.mchange.v2.c3p0.SQLWarnings : '@@tx_isolation' is deprecated and will be removed in a future release. Please use '@@transaction_isolation' instead
java.sql.SQLWarning: '@@tx_isolation' is deprecated and will be removed in a future release. Please use '@@transaction_isolation' instead
at org.mariadb.jdbc.MariaDbConnection.getWarnings(MariaDbConnection.java:548) ~[classes/:na]
at com.mchange.v2.c3p0.impl.NewProxyConnection.getWarnings(NewProxyConnection.java:907) ~[c3p0-0.9.1.2.jar:0.9.1.2]
at com.mchange.v2.c3p0.SQLWarnings.logAndClearWarnings(SQLWarnings.java:42) ~[c3p0-0.9.1.2.jar:0.9.1.2]
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:187) [c3p0-0.9.1.2.jar:0.9.1.2]
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) [c3p0-0.9.1.2.jar:0.9.1.2]
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) [c3p0-0.9.1.2.jar:0.9.1.2]
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) [c3p0-0.9.1.2.jar:0.9.1.2]
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) [c3p0-0.9.1.2.jar:0.9.1.2]
发生场景 :
项目集成 c3p0 & mysql 时遇到 ;
@@tx_isolation is deprecated and will be removed in a future release.Please use ‘@@transaction_isolation’ instesd
翻译 :
@@tx_isolation被禁止使用并且在未来的版本中会被移除,请使用’@@transaction_isolation’代替
错误位置 :
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-storage-mysql</artifactId>
<version>2.9.4</version>
</dependency>
org.mariadb.jdbc.MariaDbConnection
错误原因 :
此错误信息 , 为 c3p0 ,zipkin, 和 mysql 版本 差异 问题导致 ,
在mysql 5.7版本有更新SQL语句 , SQLAlchemy ;
此 错误信息 是个警告 , 而不是错误 ; 不解决的话 , 貌似也没发现什么问题 ;
解决办法 :
根据 错误信息 找到 MariaDbConnection.class 的源码 位置
根据错误信息 , 修改 源码 中 @@tx_isolation 为 @@transaction_isolation 即可解决