Lesson 8: 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 the client databases.

  • Use the MobiLink Monitor to detect the conflict.

 To configure the MobiLink Monitor to detect update conflicts
  1. Click Start » Programs » SQL Anywhere 12 » Administration Tools » MobiLink Monitor.

  2. Connect to the MobiLink server:

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

  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.

The first clients 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 generate an update conflict
  1. Connect to the remote1 database in Interactive SQL if you are not already connected.

    Run the following command:

    dbisql -c "server=remote1;uid=DBA;pwd=sql"
  2. Update the Screwmaster Drill quantity to seven.

    Run the following SQL script:

    UPDATE Product SET quantity = 7
        WHERE name ='Screwmaster Drill'
    COMMIT
  3. Synchronize the remote1 database with the consolidated database.

    Run the following command:

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

    The consolidated database updates the Screwmaster Drill quantity to seven.

  4. Connect to the remote2 database in Interactive SQL if you are not already connected.

    Run the following command:

    dbisql -c "server=remote2;uid=DBA;pwd=sql"
  5. Update the Screwmaster Drill quantity to six.

    UPDATE Product SET quantity = 6
        WHERE name ='Screwmaster Drill'
    COMMIT
  6. Synchronize the remote2 database with the consolidated database.

    Run the following command:

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

You 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 Monitor » Pause Chart Scrolling.

  2. View statistical information about the synchronization using the MobiLink Monitor Overview pane (the bottom pane), Chart pane, the Utilization Graph pane, and Details Table table.

    1. Locate the synchronizations in the MobiLink Monitor Overview pane. 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. Double-click the synchronization object or the corresponding row in the Details Table pane to view synchronization properties.

    5. Choose the Upload tab to see the number of conflicted updates.

 Further reading