Lesson 9: Setting the remote ID

This lesson assumes you have completed all preceding lessons. See Lesson 1: Designing the schemas.

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).

 Set the remote ID to a valid store identifier
  1. Choose a valid store identifier.

    1. Connect to the pubs2 database as sa, using iSQL 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 option 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 iSQL, 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 "SERVER=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   specifies the user name used to connect to your remote database.

    • pwd   specifies 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.

  3. Proceed to Lesson 10: Synchronizing.

 See also