java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed (1 reply)
I am using MySQL Connector/J 5.1.6, and I've got the following exception in my application:
java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1516)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1485)
at com.mysql.jdbc.RowDataDynamic.close(RowDataDynamic.java:195)
at com.mysql.jdbc.ResultSetImpl.realClose(ResultSetImpl.java:7473)
at com.mysql.jdbc.ResultSetImpl.close(ResultSetImpl.java:881)
After looking at code in MySQL driver I see that driver tries to execute statement:
stmt.executeUpdate("SET net_write_timeout=" + oldValue);
But if transaction is read only (as in my case), this code will throw an exception. I consider this is a bug in the MySQL driver since I do not expect any update statements when I am closing result set.
Should I post a bug report for this or there is something I missed?