Contents Index Lesson 1: Creating your databases Lesson 3: Running the MobiLink synchronization server

MobiLink Synchronization User's Guide
  Tutorial: Writing SQL Scripts Using Sybase Central

Lesson 2: Creating scripts for your synchronization


You can view, write, and modify synchronization scripts using Sybase Central. In this section you add 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 database using the MobiLink plug-in.

  2. Select the Versions folder. Double-click Add Version.

    The Add a New Script Version dialog appears.

  3. Name the new version default. Click Finish.

To add synchronized tables to your consolidated database

  1. In the MobiLink Synchronization plug-in of Sybase Central, select the Tables folder and double-click DBA.

    You will see two tables, emp and cust.

  2. Right-click each table and choose Add to Synchronized Tables.

Now that you have designated these tables as 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. In the MobiLink Synchronization plug-in of Sybase Central, select the Synchronized Tables folder. You will see two tables, emp and cust. Double-click the emp table.

  2. Double-click Add Table Script. The following dialog appears.

    The Add Table Script wizard.
  3. Select the upload_insert event from the dropdown list.

  4. Click Finish.

  5. Type the following SQL statement into the edit screen:

    INSERT INTO emp (emp_id, emp_name)
    VALUES ( ?, ? )
  6. Save the script.

  7. Close the dialog.

  8. Repeat steps 2 to 7 for the download_cursor event using the following SQL statement:

    SELECT emp_id, emp_name FROM emp
  9. Select the cust table.

  10. Repeat steps 2 to 7 for the upload_insert event using the following SQL statement:

    INSERT INTO cust
    (cust_id, emp_id, cust_name)
    VALUES ( ?, ?, ? )
  11. Repeat steps 2 to 7 for the download_cursor event using the following SQL statement:

    SELECT cust_id, emp_id, cust_name
    FROM cust
Further reading 

For more information about the scripts you just created, see upload_insert table event and download_cursor cursor event.

For more information about script versions, see Script versions.

For more information about adding scripts, see Adding and deleting scripts in your consolidated database.

For more information about writing table scripts, see Table scripts.

For more information about writing synchronization scripts, see Writing Synchronization Scripts.


Contents Index Lesson 1: Creating your databases Lesson 3: Running the MobiLink synchronization server