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 salesperson. The synchronization scripts you wrote included logic that instructed 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 salesperson identifier.

You must complete this step before the first synchronization because when the remote device synchronizes for the first time, it downloads all information related to the chosen salesperson.

 Set the remote ID to a valid salesperson identifier
  1. Choose a valid salesperson identifier:

    1. Connect as the SYS user with SYSDBA privileges using the Oracle SQL Plus application. At a command prompt, run the following command:

      sqlplus SYS/your-password-for-sys as SYSDBA
    2. To view a list of valid salesperson identifiers in the ORDERS table, execute the following statement:

      SELECT COUNT( SALES_REP_ID ), SALES_REP_ID
      FROM OE.ORDERS GROUP BY SALES_REP_ID;

      In this example, the remote database represents a salesperson with a SALES_REP_ID of 154.

    3. To exit Oracle SQL Plus, run the following command:

      exit
  2. To set the database's remote ID to a value of 154, run the following command:

    dbisql 
    -c "SERVER=remote_eng;DBN=remote_db;UID=DBA;PWD=sql"
    "SET OPTION PUBLIC.ml_remote_id='154';"
    • 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='154'   is the SQL statement used to set the remote ID to a value of 154.

  3. Proceed to Lesson 10: Synchronizing.