8.9.3 Providing Information to Choose a MySQL Server

If you create a Fabric connection without providing any information about which data to access, the connection cannot function. To access a database, you must provide the driver with one of the following:

The following discussion describes both ways of providing information. In the examples, conn represents the Fabric connection object, created as shown in Section 8.9.2, “Loading the Driver and Requesting a Fabric Connection”.

Providing the name of a high-availability group specifies that we know exactly the set of database servers with which to interact. We can do this in two ways.

Providing shard information avoids the need to choose a high-availability group manually and permits Connector/J to do so based on information from the MySQL Fabric server.

In summary, it is necessary to provide the name of a server group or a shard table and possibly shard key to access a database server.