Pre-General Availability Draft: 2018-01-15
When using the X Protocol, Connector/J (since release 6.0.5) supports a client-side failover feature for establishing a Session. If multiple hosts are specified in the connection URL, when Connector/J fails to connect to a listed host, it tries to connect to another one. This is a sample X DevAPI URL for configuring client-side failover:
An alternate format can also be used, with which the priority for connection can be set explicitly for each individual host:
With the client-side failover configured, when there is a failure to establish a connection, Connector/J keeps attempting to connect to a host on the host list in the order of the set priorities for the hosts, which are specified by any numbers between 0 to 100, with a larger number indicating a higher priority for connection. Priorities should either be set for all or no hosts. When no priorities are specified, the priorities for connection are established according to the order the hosts appear in the list, with a host appearing earlier in the list receiving a higher priority.
Notice that this feature only allows for a failover when Connector/J is trying to establish a connection, but not during operations after a connection has already been made.