Problem Description:after starting the transaction, the Java code makes a query, then inserts, which is reported at this time: java.sql.SQLException:could not retrieve transation read-only status server
resolution process:
View MySQL 's things isolation level show VARIABLES like '%iso% ';
results returned: repeatable-read
change this to: read-committed: SET GLOBAL tx_isolation= ' read-committed ';
(Remember the Java Restart app, to be permanently active, change the My.ini configuration file )
Problem Analysis:
When the database isolation level is repeatable-read, querying a SELECT statement is also the beginning of things, and in hibernate, transactions that begin with a SELECT statement are marked as read-only transactions. At this point, the execution of the INSERT, UPDATE, DELETE and other DML statements will be error.
Http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_tx_read_only
From for notes (Wiz)
MySQL Error: Could not retrieve transation read-only status server