MySQL Forums :: JDBC and Java :: new connection implicitly created when autoReconnect was disabled
new connection implicitly created when autoReconnect was disabled
Posted by:
murat cengiz ()
Date: December 20, 2012 03:14PM
Hi,
I am experiencing some strange behavior related to "autoReconnect" parameter.
Here are the steps for a simple test i have run:
1 - get a connection from driver (having autoReconnect=false in the url)
2 - execute an sql
3 - make the master (primary) server unavailable (i.e. unplug network cable)
4 - execute sql on the connection (SHOULD fail)
5 - execute sql on the same connection again (SHOULD fail)
* monitor tcp connections throughout the test. NO connections to slave host should be opened.
url: jdbc:mysql://dbmaster,dbslave:3306/TESTDB?autoReconnect=false&connectTimeout=5000&socketTimeout=30000&relaxAutoCommit=true&
failOverReadOnly=false&characterEncoding=UTF-8
connector/j : 5.1.18 (and 5.1.22 with same results)
java: 1.6(.0.37)
I assumed that connector/j would not automatically "reconnect" a connection when autoReconnect was disabled.
But it seems that a connection is created against the slave(dbslave) at step 5. (at which the connection had already received a communications exception)
any comments?
thanks
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.