Lesson 8: Synchronizing

This lesson assumes you have completed all preceding lessons. See Lesson 1: Setting up an Excel worksheet.

The dbmlsync utility initiates MobiLink synchronization for SQL Anywhere remote databases. Before starting dbmlsync, add order data and comments to your remote database.

 Set up your client-side remote data and synchronize
  1. Connect to the MobiLink client database from Interactive SQL if you are not already connected.

    Run the following command:

    dbisql -c "SERVER=remote1;UID=DBA;PWD=sql"
  2. Add an order to the RemoteOrders table in the client database.

    Execute the following SQL statement in Interactive SQL:

    INSERT INTO RemoteOrders (order_id, product_id, quantity, order_status)
     VALUES (1,12312,10,'new');
  3. Add a comment to the OrderComments table in the client database.

    Execute the following SQL statement in Interactive SQL:

    INSERT INTO OrderComments (comment_id, order_id, order_comment)
     VALUES (1,1,'send promotional material with the order');
  4. Commit your changes.

    Execute the following SQL statement in Interactive SQL:

    COMMIT;
  5. Run the following command at a command prompt:

    dbmlsync -c "SERVER=remote1;UID=DBA;PWD=sql" -e scn=on -o rem1.txt -v+

    The following table contains a description for each dbmlsync option used:

    Option Description
    -c Specifies the connection string.
    -e scn Sets SendColumnNames to on. This is required by direct row handling if you want to reference columns by name.
    -o Specifies the message log file rem1.txt.
    -v+ The -v option specifies what information is logged. Using -v+ sets maximum verbose logging.

    Once you have started the MobiLink synchronization client, an output screen appears indicating that the synchronization succeeded. SQL-based synchronization transferred rows in the client RemoteOrders table to the RemoteOrders table in the consolidated database.

    Java processing inserted your comment in the order_central.xlsx worksheet. The information stored in the order_central.xlsx worksheet is downloaded to the client.

  6. In Interactive SQL, select from the OrderComments table to verify that the row was downloaded.

    Execute the following SQL statement in Interactive SQL:

    SELECT OrderComments;
    Note

    Rows downloaded using direct row handling are not printed by the mlsrv12 -v+ option, but are printed in the remote log by the remote -v+ option.

  7. Proceed to Cleaning up.

 See also