Contents Index MobiLink users MobiLink events

MobiLink Synchronization User's Guide
  Synchronization Basics

The synchronization process


A synchronization is the process of bidirectional data exchange between the MobiLink client and synchronization server. During this process, the client must establish and maintain a connection to the synchronization server. If successful, the session leaves the remote and consolidated databases in a mutually consistent state.

The client normally initiates the synchronization process. It begins by establishing a connection to the MobiLink synchronization server.

The upload stream and the download stream 

To upload rows, MobiLink clients prepare and send an upload stream that contains a list of all the rows that have been updated, inserted, or deleted on the MobiLink client since the last synchronization. Similarly, to download rows, the MobiLink synchronization server prepares and sends a download stream that contains a list of inserts, updates, and deletes.

  1. Upload stream    The MobiLink client automatically keeps track of which rows in the remote database have been inserted, updated, or deleted since the previous successful synchronization. Once the connection is established, the MobiLink client uploads a list of all these changes to the synchronization server.

    The upload stream consists of a set of new and old row values for each row modified in the remote database. If a row has been updated or deleted, the old values are those that were present immediately following the last successful synchronization. If a row has been inserted or updated, the new values are the current row values. No intermediate values are sent, even if the row was modified several times before arriving at its current state.

    The MobiLink synchronization server receives the upload stream and applies the changes to the consolidated database. It normally applies all the changes in a single transaction. When it has finished, the MobiLink synchronization server commits the transaction.

    Note 
    MobiLink operates using the ODBC isolation level SQL_TXN_READ_COMMITTED as the default isolation level for the consolidated database. MobiLink does so because repeatable reads are required for conflict detection purposes. If you have no conflict detection scripts or if you want to select an isolation level more suited to your needs, you can set this level in your begin_connection script.
  2. Download stream    The MobiLink synchronization server compiles a list of rows to be inserted, updated, or deleted on the MobiLink client, using synchronization logic that you create. It downloads these rows to the MobiLink client. To compile this list, the MobiLink synchronization server opens a new transaction on the consolidated database.

    The MobiLink client receives the download stream. It takes the arrival of this stream as confirmation that the consolidated database has successfully applied all uploaded changes. It will then ensure these changes are not sent to the consolidated database again.

    Next, the MobiLink client automatically processes the download stream, deleting old rows, inserting new rows, and updating rows that have changed. It applies all these changes in a single transaction in the remote database. When finished, it commits the transaction.

  3. Optional download acknowledgement    The MobiLink client optionally sends a short confirmation message to the MobiLink synchronization server.

    The MobiLink synchronization server receives the confirmation message. This message tells the synchronization server that the client has received and processed all downloaded changes. In response, it commits the download transaction begun in step 2.

    For more information about the SendDownloadAck extended option, see SendDownloadACK (sa) extended option and Send Download Acknowledgement synchronization parameter.

During MobiLink synchronization, there are few distinct exchanges of information. The client builds and uploads the entire upload stream. In response, the synchronization server builds and downloads the entire download stream. Limiting the chattiness of the protocol is especially important when communication is slower and has higher latency, as is the case when using telephone lines or public wireless networks.


MobiLink events
Stored procedures
Transactions in the synchronization process
How synchronization failure is handled
How the upload stream is processed
Referential integrity and synchronization

Contents Index MobiLink users MobiLink events