Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » MobiLink - Getting Started » MobiLink tutorials » Tutorial: Using MobiLink with an Oracle Database 10g

 

Lesson 9: Setting the remote ID

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 before the first synchronization because when the remote device synchronizes for the first time, it downloads all information related to the chosen salesperson.

Prerequisites

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

This lesson assumes you have the roles and privileges listed in the Permissions and privileges section at the start of this tutorial: Tutorial: Using MobiLink with an Oracle Database 10g.

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

Results

The database's remote ID is set to the value of a valid salesperson identifier.