java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
Posted by: Pavel Sher
Date: August 11, 2008 08:29AM

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?

Options: ReplyQuote


Subject
Written By
Posted
java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
August 11, 2008 08:29AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.