Contents Index Scheduling synchronization UltraLite Clients

MobiLink Synchronization User's Guide
  Adaptive Server Anywhere Clients

Adaptive Server Anywhere version 7 MobiLink clients


Adaptive Server Anywhere 7.0 MobiLink clients were configured using SQL statements that are now deprecated. In particular, synchronization definitions were used instead of publications and subscriptions. The older statements are no longer supported. They have some disadvantages:

  1. A synchronization definition is equivalent to a single publication and a single subscription to it. There is no support for subscriptions to multiple publications. In contrast, a single MobiLink user can now subscribe to multiple publications. This allows you to synchronize some portions of your data without synchronizing all of it.

  2. Some people found the old terminology confusing. For example, a MobiLink user ID was formerly called a site in the context of an Adaptive Server Anywhere client. A MobiLink user is now called a MobiLink user or a synchronization user.

  3. The new statements are analogous to those used in SQL Remote, the Sybase message-based replication technology.

Synchronization definitions identify data to upload in version 7 remote databases 

You can choose to synchronize all or any portion of the data in a client Adaptive Server Anywhere database. You can choose to synchronize entire tables, or you can choose to synchronize only particular columns and rows.

The synchronization definition, located in the client Adaptive Server Anywhere database, describes the data that is to be replicated and the location of the appropriate MobiLink synchronization server.

Synchronization scripts, stored in the consolidated database, control how the uploaded rows are processed and which rows are downloaded to the remote database. These scripts do not depend on the type of remote database.

A synchronization definition may include data from several database tables. Each table's contribution to a synchronization definition is called an article . Each article may consist of a whole table, or a subset of the rows and columns in a table.

The figure shows a two-table synchronization definition, featuring one article using all rows and columns from Table A, and another article with some rows and columns from Table B.
Synchronizing a remote database 

Once a remote database is set up, the two databases must be periodically brought to a state where they both have the same set of information. This process of synchronization is carried out using the dbmlsync command line utility.

Altering a synchronized table 

A table, once added to a synchronization definition, should not be altered. Altering the table interferes with the synchronization process. Should it be necessary to make such an alteration, this step should be performed immediately following synchronization.

The only way to ensure that the ALTER STATEMENT is executed immediately following synchronization is to place this statement in a script, then execute that script using the -i option of the dbmlsync command line utility.

Comparison to UltraLite clients 

If you have developed UltraLite applications for use as MobiLink clients, the following information may be helpful. Many of the elements of a synchronization definition have an UltraLite counterpart.

Adaptive Server Anywhere 9.0 client Adaptive Server Anywhere 7.0 client UltraLite clients MobiLink synchronization server
MobiLink synchronization user site user name MobiLink user
type type stream connection type
address address connection parameters the server's address
script version script version version script version
publication part of a definition in a remote database, or part of a template in a reference database none —all tables are synchronized publication
subscription part of a definition in a remote database, or a part of a site in a reference database none none
Writing synchronization definitions 

The synchronization definition is a version 7.0 database object describing data in an Adaptive Server Anywhere remote database that is to be synchronized with a particular MobiLink synchronization server. When using Adaptive Server Anywhere 9.0 or later, publications and synchronization subscriptions should be used instead.

For details, see Creating a remote database.

A synchronization definition should appear only in an Adaptive Server Anywhere 7.0 remote database. MobiLink consolidated servers are configured using scripts.

A synchronization definition specifies the following pieces of information

The following statement creates a synchronization definition named testpub that defines what data is to be synchronized with site demo_sync_site.

CREATE SYNCHRONIZATION DEFINITION testpub
   SITE 'demo_sync_site'
   TYPE 'tcpip'
   ADDRESS 'host=localhost;port=2439;'
   OPTION sv='version1'
   (table People( person_id, fname, lname ),table Pets);

In this statement,

For the syntax of the MobiLink-synchronization-specific statements, see SQL Statements.

Synchronizing with multiple servers 

To synchronize a remote database with multiple MobiLink synchronization servers, create multiple synchronization definitions within the remote database. Each synchronization definition must have a unique site name because, from the point of view of the MobiLink synchronization server, each is a separate logical client.

Synchronizing the same data in one remote database with multiple MobiLink synchronization servers is not presently supported.

Rewriting synchronization definitions for version 8 and up 

To use an Adaptive Server Anywhere 7 database as a MobiLink client, you use a synchronization definition to identify which data to upload. In version 8.0 and later, these are better rewritten as publications and synchronization subscriptions.

Example 

Suppose you wanted to synchronize the Customer and Sales_Order tables of the sample database. You could have created the following synchronization definition.

CREATE SYNCHRONIZATION DEFINITION testpub
   SITE 'demo_ml_user'
   TYPE 'tcpip'
   ADDRESS 'host=localhost;port=2439;'
   OPTION sv='version1'
   (TABLE Customer, TABLE Sales_Order);

Instead, you should now do the following.

  1. First, publish the Customer and Sales_Order tables.

    CREATE PUBLICATION testpub
       (TABLE Customer, TABLE Sales_Order);
  2. Next, create a subscription to this publication for the MobiLink user. In this case, the MobiLink user is demo_ml_user. It is unnecessary that a database user of the same name to exist. MobiLink users and database users are independent.

    CREATE SYNCHRONIZATION SUBSCRIPTION TO testpub
       FOR demo_ml_user
       TYPE 'tcpip'
       ADDRESS 'host=localhost;port=2439;'
       OPTION sv='version1'

The information is the same, but is broken into two smaller statements instead of one large one.

The SITE clause in the synchronization definition specifies that this particular MobiLink client will synchronizing using the MobiLink user id demo_sync_site. Synchronization is to occur over a TCP/IP connection. The synchronization server is to use the version1 version of the synchronization scripts when interacting with this client.

In the second case, the synchronized tables are published, and then a subscription is created for the demo_sync_site MobiLink user. The TYPE, ADDRESS, and OPTION clauses have the same syntax.


Contents Index Scheduling synchronization UltraLite Clients