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: Synchronizing with Microsoft Excel

 

Lesson 3: Creating a table in your MobiLink consolidated database

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

Prerequisites

This lesson assumes you have completed all preceding lessons. See Lesson 1: Setting up an Excel worksheet.

This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Synchronizing with Microsoft Excel.

Context and remarks

The RemoteOrders table you create in this lesson 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.

 Task
  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=mlexcel_db"
  2. Execute the following SQL statements 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 SQL 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.

Results

The RemoteOrders table is created in the consolidated database.