java.sql.SQLException: Could not retrieve transation read-only status server
最近在做整合springboot的项目,但是在整合mybatis出现了下面的问题:
java.sql.SQLException: Could not retrieve transation read-only status server at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:937) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:872) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:904) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:894) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3613) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3582) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.alibaba.druid.pool.DruidConnectionHolder.(DruidConnectionHolder.java:143) ~[druid-1.0.29.jar:1.0.29] at com.alibaba.druid.pool.DruidConnectionHolder.(DruidConnectionHolder.java:83) ~[druid-1.0.29.jar:1.0.29] at com.alibaba.druid.pool.DruidDataSource.put(DruidDataSource.java:1890) ~[druid-1.0.29.jar:1.0.29] at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2143) [druid-1.0.29.jar:1.0.29]Caused by: java.sql.SQLException: Unknown system variable 'tx_read_only' at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2531) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2489) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1446) ~[mysql-connector-java-5.1.35.jar:5.1.35] at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3607) ~[mysql-connector-java-5.1.35.jar:5.1.35] ... 5 common frames omitted2018-12-06 21:35:41.179 INFO 9611 --- [eate-2067737171] com.alibaba.druid.pool.DruidDataSource : put physical connection to pool failed.Process finished with exit code 130 (interrupted by signal 2: SIGINT)
这是因为我的mysql 是8.0,然后我的驱动用的是5.0的,这个时候需要修改pom.xml,添加8.0的驱动:
mysql mysql-connector-java 8.0.11
参考文献
[1].mysql 数据库8.0版本,jdbc驱动连接问题
[2].解决java.sql.SQLException: Could not retrieve transation read-only status server
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
暂时没有评论,来抢沙发吧~