Lesson 6: Start the server and client

In this lesson, you start the MobiLink server and remote database.

Previously, you modified the download cursor script to download information related to one store. In this lesson, you specify the store by setting the remote ID to the store identifier.

To start the MobiLink server
  1. At a command prompt, navigate to the folder where you created the synchronization model. (This is the root directory you chose in the first step of the Synchronization Model Wizard.)

    If you used the suggested directory names, you should navigate to the following directory: sync_ase\mlsrv.

  2. To start the MobiLink server, run the following command:

    sync_ase_mlsrv.bat "dsn=ase_cons;uid=sa;pwd=your password for sa account;"
    • sync_ase_mlsrv.bat   is the command file to start the MobiLink server.

    • dsn   is your ODBC data source name.

    • uid   is the user name you use to connect to the consolidated database (the default for Adaptive Server Enterprise is sa).

    • pwd   is the password you use to connect as sa.

    When this command runs successfully, the message MobiLink Server Started appears in the MobiLink Server Messages window.

    If the MobiLink server fails to start, check connection information for your consolidated database.

To start the remote database
  1. At a command prompt, navigate to the directory where the Deploy Synchronization Model Wizard created your remote database.

    If you used the suggested directory names, you navigate to the following directory: sync_ase\remote.

  2. To start your remote SQL Anywhere database, run the following command:

    dbeng11 -n remote_eng sync_ase_remote.db -n remote_db
    • dbeng11   is the database server used to start the SQL Anywhere database.

    • remote_eng   is the database server name.

    • sync_ase_remote.db   is the database file that is started on remote_eng.

    • remote_db   is the name of the database on remote_eng.

    When this command runs successfully, a SQL Anywhere database server named remote_eng starts and loads the database called remote_db.

Set the remote ID

In the remote schema, each remote database represents one store. The synchronization scripts you wrote include logic that instructs the MobiLink server to download a subset of data based on the remote ID of the remote database. You must set the database's remote ID to the value of a valid store identifier.

It is important to complete this step before the first synchronization because when the remote device synchronizes for the first time, it downloads all information related to the store (in this case, Thoreau Reading Discount Chain).

To set the remote ID to a valid store identifier
  1. Choose a valid store identifier.

    1. Connect to the pubs2 database as sa, using the isql utility in Adaptive Server Enterprise. At a command prompt, run the following command, all on one line:

      isql
      -U sa
      -P Your password for sa account
      -D pubs2

      If you are accessing Adaptive Server Enterprise remotely, use the -S parameter to specify the server name.

    2. To view a list of valid store identifiers in the stores table, execute the following statement:

      SELECT * FROM stores

      In this tutorial, the remote database represents the Thoreau Reading Discount Chain store, which has a value of 5023 for its store identifier.

    3. To exit Adaptive Server Enterprise, run the following command:

      exit
  2. To set the database's remote ID to 5023, run the following command, all on one line:

    dbisql
       -c "eng=remote_eng;dbn=remote_db;uid=DBA;pwd=sql"
       "SET OPTION PUBLIC.ml_remote_id='5023'"
    • dbisql   is the application used to execute SQL commands against a SQL Anywhere database.

    • eng   specifies the database server name remote_eng.

    • dbn   specifies the database name remote_db.

    • uid   is the user name used to connect to your remote database.

    • pwd   is the password used to connect to your remote database.

    • SET OPTION PUBLIC.ml_remote_id='5023'   is the SQL command used to set the remote ID to 5023.

Further reading