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

SQL Anywhere 11.0.1 (Français) » MobiLink - Getting Started » MobiLink Tutorials » Tutorial: Writing Scripts and Monitoring Synchronizations

 

Lesson 7: Use the MobiLink Monitor to detect update conflicts

You can use the MobiLink Monitor to collect statistical information about synchronizations as they occur. The MobiLink Monitor's graphical chart shows tasks on the vertical axis against the progression of time on the horizontal axis.

Using the MobiLink Monitor, you can quickly identify synchronizations that result in errors or satisfy certain conditions. Since the MobiLink Monitor does not significantly degrade performance, it is recommended for both development and production.

In this section you:

  • Start and configure the MobiLink Monitor to visibly distinguish synchronizations that involve update conflicts.

  • Generate a conflict by updating the same row on remote1 and remote2.

  • Use the MobiLink Monitor to detect the conflict.

♦  To configure the MobiLink Monitor to detect update conflicts
  1. Click Start » Programs » SQL Anywhere 11 » MobiLink Monitor.

  2. Connect to the MobiLink Server:

    1. Click the Identification tab.

    2. In the User field, type monitor_user. As you started the MobiLink server with the -zu+ option, this user is added automatically.

    3. In the Password field, type a password or leave the field blank.

    4. Click the Database tab.

    5. In the Server Name field, type cons.

    6. Click OK.

  3. Click Tools » Watch Manager to start the MobiLink Monitor Watch Manager.

  4. Add a new watch for update conflicts:

    1. Click New.

    2. In the Name field, type conflict_detected.

    3. In the Property list, click conflicted_updates.

      The conflicted_updates statistical property indicates the number of uploaded updates for which conflicts were detected.

      For more information about MobiLink Monitor statistical properties, see MobiLink statistical properties.

    4. In the Operator list, click is greater than.

    5. In the Value field, type 0.

    6. Click Add.

    7. In the Chart Pattern list, set the pattern for the Chart pane. The Chart pane is the middle pane in MobiLink Monitor.

    8. In the Overview color list, set the color for the Overview pane. The Overview pane is the bottom pane in the MobiLink Monitor.

  5. Click OK.

  6. Click OK.

♦  To generate an update conflict
  1. Update the remote1 inventory value.

    Salesman1 starts with a Screwmaster Drill inventory of ten items, and then sells three. He updates the inventory on his remote database, remote1, to seven items. To perform the update:

    1. Start Interactive SQL and connect to remote1 (if not already connected).

    2. Update the Screwmaster Drill inventory to 7 items by executing the following in Interactive SQL.

      UPDATE Product SET quantity = 7
       WHERE name ='Screwmaster Drill'
      COMMIT
  2. Synchronize remote1.

    At a command prompt, type the following command to start the MobiLink synchronization client:

    dbmlsync -c "eng=remote1;uid=DBA;pwd=sql" -v+

    Following synchronization, the consolidated database Screwmaster Drill inventory is 7 items.

  3. Update the remote2 inventory value.

    Salesman2 sells four items and updates her inventory (on remote2) to six. When remote2 synchronizes, a conflict is detected because the inventory value in the consolidated database has changed. To perform the update:

    1. Start Interactive SQL and connect to remote2.

      At a command prompt, type the following command:

      dbisql
    2. Click the Identification tab.

    3. In the User ID field, type DBA.

    4. In the Password field, type sql.

    5. Click the Database tab.

    6. In the Server Name field, type remote2.

    7. Click OK.

    8. Update the Screwmaster Drill inventory to 6 items by executing the following in Interactive SQL:

      UPDATE Product SET quantity = 6
       WHERE name ='Screwmaster Drill'
      COMMIT
  4. Synchronize remote2.

    • Start the MobiLink synchronization client.

      At a command prompt, type the following command:

      dbmlsync -c "eng=remote2;uid=DBA;pwd=sql" -v+

Now you can switch to the MobiLink Monitor and view the results of the synchronization.

♦  To detect the update conflict using the MobiLink Monitor
  1. Pause Chart Scrolling.

    Click File » Monitor » Pause Chart Scrolling.

  2. View statistical information about the synchronization using the MobiLink Monitor's Overview pane, Chart pane, and Details table.

    1. Locate the synchronizations in the Monitor's Overview pane (the bottom pane in the MobiLink Monitor). The remote2 synchronization which generated an update conflict, appears in red:

    2. To view the remote2 synchronization in the Chart pane, click and drag over the synchronization object in the Overview pane:

      The synchronization object is displayed with the pattern you chose for the conflict_detected watch.

    3. Use the zoom tool to view synchronization detail.

      From the View menu, choose Zoom In.

    4. To view synchronization properties, double-click the synchronization object or the corresponding row in the details table. Choose the Upload tab to see the number of conflicted updates.

Further reading

For more information about MobiLink conflict resolution, see Handling conflicts.

For more information about the MobiLink Monitor, see MobiLink Monitor.

For more information about MobiLink Monitor statistical properties, see MobiLink statistical properties.