Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » MobiLink - Getting Started » MobiLink tutorials » Tutorial: Using direct row handling

 

Lesson 8: Synchronizing

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

Prerequisites

This lesson assumes you have completed all preceding lessons. See Lesson 1: Setting up a text file data source.

This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Using direct row handling.

 Task
  1. Connect to the MobiLink client database from Interactive SQL, if you are not already connected, by running the following command:

    dbisql -c "SERVER=remote1;UID=DBA;PWD=sql"
  2. Execute the following statement to add an order to the RemoteOrders table in the client database:

    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 by executing the following statement in Interactive SQL:

    INSERT INTO OrderComments (comment_id, order_id, order_comment)
     VALUES (1,1,'send promotional material with the order');
  4. Execute the following statement in Interactive SQL to commit your changes:

    COMMIT;
  5. Run the following command:

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

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

    Option Description
    -c Specifies the connection string.
    -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. The SQL-based synchronization transfers rows in the client's RemoteOrders table to the RemoteOrders table in the consolidated database.

    Java or .NET processing inserted your comment in orderComments.txt.

  6. Close any SQL Anywhere MobiLink client windows.

  7. Insert a response in orderResponses.txt to download to the remote database. This action takes place on the server side.

    Add the following text to orderResponses.txt. You must separate entries using the tab character. At the end of the line, press Enter.

    1	1	Promotional material shipped
  8. Run synchronization using the dbmlsync client utility.

    This action takes place on the client-side.

    Run the following command:

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

    The MobiLink client utility appears.

    Note

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

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

    Execute the following SQL statement:

    SELECT * FROM OrderComments;

Results

The SQL Anywhere remote database is updated and the synchronized with the consolidated database.

Next

Proceed to Cleaning up.

 See also