Contents Index Lesson 1: Create your databases Lesson 3: Start the MobiLink synchronization server

Introducing SQL Anywhere Studio
  Tutorial: Synchronizing Databases with MobiLink

Lesson 2: Prepare the databases for synchronization


Synchronization is governed by the following:

You can write, view and modify synchronization scripts as well as publications and subscriptions using Sybase Central.

Create a synchronization subscription and publication 

The MobiLink synchronization publication, user, and subscription are necessary for MobiLink synchronization to happen. Each is defined in the remote database.

To add a publication and synchronization subscription to the remote database

  1. Start Sybase Central and connect to your remote database:

  2. Add a publication to the remote database:

  3. Add a MobiLink user name to the remote database:

  4. Subscribe the MobiLink user to the publication:

  5. Add address information to the subscription:

    Address information is used to enable the MobiLink client to locate the correct MobiLink synchronization server.

This completes the preparation of the remote database. The next step is to add synchronization scripts for the consolidated database.

Add synchronization scripts to the consolidated database 

Each script belongs to a designated script version. You must add a script version to the consolidated database before you add scripts.

To add a script version

  1. Start Sybase Central and connect to the test_consol data source using the MobiLink plug-in.

  2. Open the Versions folder.

  3. Double click Add Version. Name the new version default.

To add synchronized tables to your consolidated database

  1. Open the Tables folder beneath the MobiLink Synchronization9 icon.

  2. Open the DBA container. Right-click the cust table and add it to synchronized tables.

Now that you have designated these tables as tables to be synchronized, you can add a new table script for each upload and download to the consolidated database.

To add table scripts to each synchronized table

  1. Open the Synchronized Tables folder, and double-click the cust table.

  2. Double click Add Table Script in the right pane. The Add Synchronizing Table Script wizard appears.

  3. Select the upload_insert event from the drop list.

  4. Click Finish.

  5. Type the following code into the dialog:

    INSERT INTO cust ( cust_id, emp_id, cust_name )
    VALUES ( ?, ?, ? )
  6. Save the script and close the dialog.

  7. Repeat this step for the download_cursor event, using the following script:

    SELECT cust_id, emp_id, cust_name
    FROM cust

You have now generated scripts that perform a snapshot synchronization of your database, uploading new rows to the consolidated database and downloading rows from the consolidated database to the remote. In a complete MobiLink installation, you would add scripts for other events.


Contents Index Lesson 1: Create your databases Lesson 3: Start the MobiLink synchronization server