1.1.1

Table Of Contents
You will use the encrypted secret when conguring the DBSynchronizer initialization parameters, so that
the plain-text password never appears in exception messages. The above example uses the default AES
transformation and 128-bit key size for encryption. See sqlf encrypt-password on page 371 for information
about changing those options.
5. Create the AsyncEventListener conguration
Connect to SQLFire and create a new AsyncEventListener using the DBSynchronizer. Ensure that you have
added the third-party JDBC driver JAR le to your classpath, then start sqlf and create the listener denition:
export CLASSPATH=$CLASSPATH:/path/mysql-connector-java-5.1.18-bin.jar
sqlf
sqlf> connect client 'localhost:1527';
sqlf> create asynceventlistener testlistener
> (
> listenerclass 'com.vmware.sqlfire.callbacks.DBSynchronizer'
> initparams
>
'com.mysql.jdbc.Driver,jdbc:mysql://localhost:3306/sqlfdb,user=sqlfuser,secret=25325ffc3345be8888eda8156bd1c313'
> )
> server groups (dbsync);
The LISTENERCLASS argument must specify the built-in SQLFire DBSynchronizer implementation.
The INITPARAMS argument must specify the full JDBC driver class name to use and the JDBC connection
string, separated by a comma. Notice that the INITPARAMS also includes the username and secret
options to specify the encrypted password of the user, rather than the plain-text password.
Note: You can optionally install and start the AsyncEventListener conguration after you associate
a table with the listener name. Make sure that you use the same listener name with both the CREATE
ASYNCEVENTLISTNER command and the CREATE TABLE command.
6. Start the AsyncEventListener
Use the SYS.START_ASYNC_EVENT_LISTENER procedure to start the new DBSynchronizer
implementation:
sqlf> call sys.start_async_event_listener('TESTLISTENER');
Note: The AsyncEventListener name is a SQL identier and should be entered in uppercase letters
with this procedure.
7. Create identical schema and tables in SQLFire
After you create the DBSynchronizer listener in SQLFire, create tables and associate them with the listener
to have DBSynchronizer propagate subsequent table DML operations to the third-party database. The tables
you create should use the same schema, table name, and table denitions as those you used in the third-party
database. For example:
sqlf> create schema sqlfdb;
sqlf> set schema sqlfdb;
sqlf> create table sqlftest
> (id int not null, name varchar(10))
> asynceventlistener(testlistener);
Notice that the table denition is the same as that used in MySQL, except that includes the
ASYNCEVENTLISTENER clause to associate the table with DBSynchronizer.
207
Using DBSynchronizer to Apply DML to an RDBMS