Table of Contents
The following sections discuss a number of topics that involve multi-host connections, namely, server load-balancing, failover, and replication.
Developers should know the following things about multi-host connections that are managed through Connector/J:
Each multi-host connection is a wrapper of the underlying physical connections.
Each of the underlying physical connections has its own session. Sessions cannot be tracked, shared, or copied, given the MySQL architecture.
Every switch between physical connections means a switch between sessions.
Within a transaction boundary, there are no switches between physical connections. Beyond a transaction boundary, there is no guarantee that a switch does not occur.Note
If an application reuses session-scope data (for example, variables, SSPs) beyond a transaction boundary, failures are possible, as a switch between the physical connections (which is also a switch between sessions) might occur. Therefore, the application should re-prepare the session data and also restart the last transaction in case of an exception, or it should re-prepare session data for each new transaction if it does not want to deal with exception handling.