Lesson 5: Setting up your MobiLink client database

This lesson assumes you have completed all preceding lessons. See Lesson 1: Setting up your MobiLink consolidated database.

MobiLink is designed for synchronization involving a consolidated database server and a large number of mobile databases. In this lesson, you create a remote database. You must perform the following tasks:

  • Create a T1 table, which you synchronize with the consolidated database.

  • Create a synchronization publication, user, and subscription.

In this lesson, you use a SQL Anywhere database for your consolidated database and your MobiLink client. For tutorial purposes, your MobiLink client, consolidated database, and MobiLink server all reside on the same computer.

To set up the MobiLink client database, you create a T1 table for the remote database. The T1 table corresponds to the T1 table on the consolidated database. The MobiLink server uses SQL-based scripts to synchronize product quantities.

You create a synchronization user, publication, and subscription on the client database after creating the tables. Publications identify the tables and columns on your remote database that you want synchronized. These tables and columns are called articles. A synchronization subscription subscribes a MobiLink user to a publication.

 Set up your MobiLink client databases
  1. Create your MobiLink client databases using the dbinit command line utility.

    Run the following command to create the remote database:

    dbinit remote.db
  2. Start your MobiLink client database using the dbeng12 command line utility.

    Run the following command to start the remote database:

    dbeng12 remote
  3. Connect to the remote database using Interactive SQL.

    Run the following command:

    dbisql -c "SERVER=remote;UID=DBA;PWD=sql"
  4. Create the T1 table for the remote database.

    Execute the following SQL statements in Interactive SQL:

    CREATE TABLE T1 (
        pk1      INTEGER,
        pk2      INTEGER,
        c1       VARCHAR(30000),
        PRIMARY KEY(pk1,pk2)
    );
    
    SET OPTION PUBLIC.ml_remote_id = '0';
  5. Create your MobiLink synchronization user, publication, and subscription for the remote database.

    Execute the following SQL statement in Interactive SQL:

    CREATE PUBLICATION P1 ( TABLE T1 );
    CREATE SYNCHRONIZATION USER U1;
    CREATE SYNCHRONIZATION SUBSCRIPTION TO P1 FOR U1 TYPE 'TCPIP' ADDRESS 'host=localhost;port=2439';
  6. Keep Interactive SQL open for the next lesson.

  7. Proceed to Lesson 6: Recording synchronization.

 See also