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 salesperson. In this lesson, you specify the salesperson by setting the remote ID to the salesperson identifier.

Start the MobiLink server

By default, MobiLink uses the snapshot/READ COMMITTED isolation level for upload and download. For the MobiLink server to make the most effective use of snapshot isolation, the Oracle account used by the MobiLink server must have access to the V_$TRANSACTION Oracle system view. If access is not given, a warning is issued and rows may be missed on download.

To grant access to the OE user

  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 grant access to the V_$TRANSACTION Oracle system view, run the following command:

    GRANT SELECT ON SYS.V_$TRANSACTION TO OE;

To start the MobiLink server

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

    If you used the suggested directory names, you should have the following directories located in the root directory: sync_oracle\mlsrv.

  2. Run the following command from the mlsrv directory:

    sync_oracle_mlsrv.bat "DSN=oracle_cons;UID=OE;PWD=sql;"
    • sync_oracle_mlsrv.bat    is the command file created 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.

    • PWD   is the password you use to connect to the consolidated database.

    A MobiLink Server Messages window appears. When this command runs successfully, it shows MobiLink Server Started.

    If the MobiLink server fails to start, check your 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 should have the following directories located in the root directory: sync_oracle\remote.

  2. Start your remote SQL Anywhere database with the following command:

    dbeng11 -n remote_eng sync_oracle_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_oracle_remote.db   is the database file that is started on remote_eng.

    • remote_db   is the name of the database on remote_eng.

A SQL Anywhere Server Messages window appears. 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 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.

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 chosen salesperson.

To 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, run the following command:
      exit
  2. To set the database’s remote id to a value of 154, run the following command:

    dbisql 
    -c "ENG=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 to 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 command used to set the remote ID to a value of 154.

Further reading