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 direct row handling

 

Lesson 3: Creating a table in your MobiLink consolidated database

In this lesson, you create the RemoteOrders table in the MobiLink consolidated database.

Prérequis

This lesson assumes you have completed all preceding lessons. See Lesson 1: Setting up a text file data source.

This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Using direct row handling.

Contexte et remarques

The RemoteOrders table you create contains the following columns:

  • 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 from 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=mldirect_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 16\ with the location of your SQL Anywhere 16 installation.

    READ "C:\Program Files\SQL Anywhere 16\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.

Résultat

The RemoteOrders table is created and MobiLink system tables and stored procedures are added to the consolidated database.

 See also