Synchronizing a deployed model

When you deploy a model, directories and files are optionally created in the location you chose on the first page of the Create Synchronization Model Wizard. The files and directories are named according to the model name you chose at that time.

Assume you named your model MyModel and saved it under c:\SyncModels. Depending on the deployment options you chose, you might have the following files:

Directories (based on example name and location) Description and contents (based on example name)
c:\SyncModels Contains your model file, saved as MyModel.mlsm.
c:\SyncModels\MyModel Contains folders holding your deployment files.
c:\SyncModels\MyModel\consolidated

Contains deployment files for the consolidated database:

  • MyModel_consolidated.sql - a SQL file for setting up the consolidated database.
  • MyModel_consolidated.bat - a batch file for running the SQL file.
c:\SyncModels\MyModel\mlsrv

Contains deployment files for the MobiLink server:

  • MyModel_mlsrv.bat - a batch file for running the MobiLink server. If you have set up server-initiated synchronization, it also starts the Notifier.
c:\SyncModels\MyModel\remote

Contains deployment files for the remote databases:

  • dblsn.txt - if you set up server-initiated synchronization, this is a text file with Listener option settings. It is used by MyModel_dblsn.bat.
  • MyModel_dblsn.bat - if you set up server-initiated synchronization, this is a batch file for running the Listener.
  • MyModel_dbmlsync.bat - if you deployed a SQL Anywhere remote database, this is a batch file for synchronizing SQL Anywhere databases with dbmlsync.
  • MyModel_remote.bat - a batch file for running MyModel_remote.sql.
  • MyModel_remote.db - if you chose to create a new SQL Anywhere remote database, this is the database.
  • MyModel_remote.sql - a SQL file for setting up the new SQL Anywhere remote database.
  • MyModel_remote.udb - if you chose to create a new UltraLite remote database, this is the database.
  • MyModel_ulsync.bat - if you deployed an UltraLite database, a batch file for testing synchronization with an UltraLite remote database using the ulsync utility.
Running the batch files

You must run the batch files that are created by the Deploy Synchronization Model Wizard from the command line, and you must include connection information. You may need to create ODBC data sources before running these batch files.

See Working with ODBC data sources.

To synchronize your model using batch files

  1. If you have not yet run MobiLink setup scripts on consolidated database, run them before deploying.

    See Setting up a consolidated database.

  2. When you ran the Deploy Synchronization Model Wizard, if you chose to create a file to run later (on the Consolidated Database Deployment Destination page), you must run the batch file that is located in the consolidated sub-folder of your model. This file creates all the objects you chose to have created in the consolidated database, including synchronization scripts, shadow tables, and triggers. It can also register MobiLink users in the consolidated database.

    To run this file, navigate to the consolidated directory and run the file that ends with _consolidated.bat. You must include connection information. For example, run:

    MyModel_consolidated.bat "dsn=MY_ODBC_DATASOURCE"
  3. When you ran the Deploy Synchronization Model Wizard, if you chose to create a file to run later (on the New SQL Anywhere Remote Database page or New UltraLite Remote Database page), you must run the batch file in the remote directory. This file creates all the objects you chose to have created in the remote database, including tables, publications, subscriptions, and MobiLink users.

    To run this file, navigate to the remote directory and run the file that ends with _remote.bat. For example, run:

    MyModel_remote.bat

    You are prompted for a password if you are using an existing remote database.

  4. Start the MobiLink server by running mlsrv\MyModel_mlsrv.bat. If you set up server-initiated synchronization, this also starts the Notifier. You must include connection information. For example, run:

    MyModel_mlsrv.bat "dsn=MY_ODBC_DATASOURCE"
  5. Synchronize.

    For a SQL Anywhere remote database:

    • Grant REMOTE DBA authority to a user other than DBA (recommended). For example, execute the following in Interactive SQL:
      GRANT REMOTE DBA
      TO userid, IDENTIFIED BY password

      Connect as the user with REMOTE DBA authority.

    • Start the remote database that is located in the remote directory. For example, run:
      dbeng11 MyModel_remote.db
    • Start dbmlsync, the SQL Anywhere MobiLink client. Run the file that ends with _dbmlsync.bat in the remote directory. You must include connection information. For example, run:
      MyModel_dbmlsync.bat "uid=dba;pwd=sql;eng=MyModel_remote"

    For an UltraLite remote database:

    • To test your synchronization, run the file that ends with _ulsync.bat in the remote directory.
    • Alternatively, run your UltraLite application.
  6. If you set up server-initiated synchronization, you need to perform a first synchronization and then start the Listener. The first synchronization is required to create a remote ID file. To start the Listener, run the file that ends with _dblsn.bat in the remote directory. For example, run:

    MyModel_dblsn.bat
See also