Lesson 3: Creating a table in your MobiLink consolidated database

This lesson assumes you have completed all preceding lessons. See Lesson 1: Setting up an XML data source.

In this lesson, you create a RemoteOrders table in the MobiLink consolidated database. The table contains the following columns:

Column Description

order_id

A unique identifier for orders.

product_id

A unique identifier for products.

quantity

The number of items sold.

order_status

The order status.

last_modified

The last modification date of a row. You use this column for timestamp-based downloads, a common technique used to filter rows for efficient synchronization.

 Create the RemoteOrders table
  1. Connect to your database using Interactive SQL.

    You can start Interactive SQL from Sybase Central or at a command prompt.

    • To start Interactive SQL from Sybase Central, right-click the MLconsolidated - DBA database and click Open Interactive SQL.

    • To start Interactive SQL at a command prompt, run the following command:

      dbisql -c "DSN=mlxml_db"
  2. Execute the following SQL statement in Interactive SQL to create the RemoteOrders table:

    CREATE TABLE RemoteOrders (
        order_id           INTEGER NOT NULL,
        product_id         INTEGER NOT NULL,
        quantity           INTEGER,
        order_status       VARCHAR(10) DEFAULT 'new',
        last_modified      TIMESTAMP DEFAULT CURRENT TIMESTAMP,
        PRIMARY KEY(order_id)
    );

    Interactive SQL creates the RemoteOrders table in your consolidated database.

  3. Execute the following statement in Interactive SQL to create MobiLink system tables and stored procedures.

    Replace C:\Program Files\SQL Anywhere 12\ with the location of your SQL Anywhere 12 installation.

    READ "C:\Program Files\SQL Anywhere 12\MobiLink\setup\syncsa.sql";

    Interactive SQL applies syncsa.sql to your consolidated database. Running syncsa.sql creates a series of system tables and stored procedures prefaced with ml_. The MobiLink server works with these tables and stored procedures in the synchronization process.

  4. Proceed to Lesson 4: Adding synchronization scripts.

 See also