Bug #27985 failoverReadOnly is not enforced
Submitted: 20 Apr 2007 15:00 Modified: 20 Apr 2007 16:18
Reporter: Alex Burgel Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.0.5 OS:Any
Assigned to: CPU Architecture:Any

[20 Apr 2007 15:00] Alex Burgel
Description:
failoverReadOnly seems to work by calling Connection.setReadOnly(). this means that any other part of an application can also call that method and make a connection writeable.

this is dangerous because it can screw up a replication set up if writes are sent to a slave. for example, spring framework calls connection.setReadOnly(false) at the end of some transactions, which makes the connection writeable.

How to repeat:
see http://lists.mysql.com/java/9040 for more details

Suggested fix:
i think failoverReadOnly should be enforced in some other way which is only accessible to the driver itself, or at least not via a standard jdbc method.
[20 Apr 2007 16:18] Mark Matthews
This has already been fixed in SVN (a few days ago), from the changelog:

- Fixed issue where a failed-over connection would let an application call 
	  setReadOnly(false), when that call should be ignored until the connection 
	  is reconnected to a writable master unless "failoverReadOnly" had been set
	  to "false".