java.sql.SQLException: Could not retrieve transaction read-only status from server 问题解决

There are two main online statement

 

The first

 

Description of the problem:  the Java code after the start of the transaction, first do a query, and then insert, this time will be reported: 
        java.sql.SQLException: could not retrieve transation read-only status server
 

Resolution process: 

        View mysql things isolation level SHOW VARIABLES LIKE '% iso%';

        Return result: REPEATABLE-READ

 

        This change: READ-COMMITTED like: SET GLOBAL tx_isolation = 'READ-COMMITTED'; 

 (Remember to restart the java applications, you want to permanently change the configuration file my.ini in force)

 

problem analysis:

        When the database isolation level to REPEATABLE-READ, a select query statement can be considered the beginning of things, but in order to hibernate in the transaction will begin with select statement is marked as read-only transactions, then re-execute insert, update in this transaction, the delete, etc. DML statements will throw an error.

 

http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_tx_read_only

 

 

The second

 

Mysql database connection appear above error, due to the mysql database version is compatible with jdbc cause problems, this error is used when mysql6.0; jdbc used is 5.0.12, 5.0.31 enough into the latest

Guess you like

Origin www.cnblogs.com/xiaohanlin/p/11077700.html
Recommended