1.1.1

Table Of Contents
For example, begin by starting MySQL if it is not already running:
sudo mysqld_safe
In a separate terminal prompt, start the mysql client and create a new database and table denition. Log on
using an account that has privileges to create a new database. For example:
mysql -u my_username -p
mysql> create database sqlfdb;
mysql> use sqlfdb;
mysql> create table sqlftest
-> (id int not null, name varchar(10));
You will create a table of the same name, "sqlftest," in SQLFire, and associate it with a DBSynchronizer.
2. Congure JDBC connectivity to the third-party database
DBSynchronizer requires a JDBC driver and connection URL to connect to the third-party database and
apply DML operations. Before you congure DBSynchronizer, use a Java client application such as SQuirreL
SQL to verify that you can connect to the database.
In the MySQL example shown in this procedure, the components necessary to establish a JDBC connection
are:
Driver JAR le: mysql-connector-java-5.1.18-bin.jar
Driver class: com.mysql.jdbc.Driver
Connection URL: jdbc:mysql://localhost:3306/sqlfdb?user=sqlfuser&password=sqlfpassword
Note: Although you can include the username and password directly in the JDBC connection URL
(as shown above), doing so runs the risk of having the plain-text password appear in exception
messages. To avoid recording plain-text passwords, this example will use an encrypted secret generated
using the sqlf encrypt-password command.
To ensure that SQLFire can access the JDBC driver class, add the JAR location to your CLASSPATH. For
example, open a new command prompt and enter:
export CLASSPATH=$CLASSPATH:/path/mysql-connector-java-5.1.18-bin.jar
3. Start a SQLFire data store in a custom server group
When you create a new AsyncEventListener such as DBSynchronizer, you must assign the listener to an
available server group. For example, to start a SQLFire data store and add it to a named server group:
mkdir sqlfdbsync
cd sqlfdbsync
export CLASSPATH=$CLASSPATH:/path/mysql-connector-java-5.1.18-bin.jar
sqlf server start -server-groups=dbsync
This starts a new SQLFire data store server and assigns it to the "dbsync" server group.
4. Encrypt the Database Credentials
Use the sqlf encrypt-password command with the external option to encrypt the database
credentials:
sqlf encrypt-password external
Enter User Name: sqlfuser
Enter password: sqlfpassword
Re-enter password: sqlfpassword
Connecting to distributed system: mcast=/239.192.81.1:10334
Encrypted to 25325ffc3345be8888eda8156bd1c313
vFabric SQLFire User's Guide206
Caching Data with vFabric SQLFire