MySQL Utilities 1.4 Manual  /  ...  /  How Connector/J Chooses a MySQL Server

8.9.8. How Connector/J Chooses a MySQL Server

Before a database server can be chosen, a server group must be chosen. The following values are taken into account:

  • server group name: If a server group name is specified directly, it is used.

  • shard table: If a shard table is given, the global group for the shard mapping governing the given shard table is used.

  • shard table + shard key: If a shard key is given the shard mapping is used to determine which server group handles data for the shard key.

  • query tables: If the query table set contains a sharded table, the shard mapping for that table will be used.

The server group name can be accessed by con.getCurrentServerGroup().getName().

Once a server group is chosen, an individual database server is chosen based on the read-only state of the connection. A read-only server is chosen if one is available. Otherwise a read-write server is chosen. The server weight is not currently taken into account.

None of these values can be changed while a transaction is in progress.

Download this Manual
PDF (US Ltr) - 1.1Mb
PDF (A4) - 1.1Mb
EPUB - 292.9Kb
HTML Download (TGZ) - 224.3Kb
HTML Download (Zip) - 236.0Kb
User Comments
Sign Up Login You must be logged in to post a comment.