When using Connector/J with MySQL Fabric, you must provide the
host name and port of the MySQL Fabric server instead of the
database server. The connection string must follow the same form
it normally does, with the addition of the
fabric keyword, as follows:
The user name and password provided to the connection are used for
authentication with the individual database servers. Fabric
authentication parameters can be given in the URL using the
fabricPassword properties. e.g.
If the username and password to authenticate to the Fabric node are omitted, no authentication is used. This should only be done when authentication has been disabled on the Fabric node.
If you are using Java 5, you must manually load the driver class before attempting to connect.
Connection now proceeds normally.
Connection conn = DriverManager.getConnection( "jdbc:mysql:fabric://fabrichost:32274/database", user, password);
To use the Connector/J APIs that support MySQL Fabric, you must
Connection object to the public
interface that provides the necessary methods. The interfaces are:
JDBC3 interface, compatible with Java 5 and later
JDBC4 interface, compatible with Java 6 and later. This
interface must be used to access JDBC4 APIs on the connection.