Documentation Home
MySQL Connector/J 8.0 Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 455.3Kb
PDF (A4) - 458.4Kb
HTML Download (TGZ) - 109.7Kb
HTML Download (Zip) - 127.8Kb

MySQL Connector/J 8.0 Developer Guide  /  Multi-Host Connections

Pre-General Availability Draft: 2018-03-20

Chapter 9 Multi-Host Connections

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.


    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.

User Comments
Sign Up Login You must be logged in to post a comment.