Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » MobiLink - Getting Started » MobiLink Tutorials » Tutorial: Synchronizing with Microsoft Excel

 

Lesson 6: Set up your MobiLink client

In this tutorial, 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 the RemoteOrders and OrderComments tables. The RemoteOrders table corresponds to the RemoteOrders table on the consolidated database. The MobiLink server uses SQL-based scripts to synchronize remote orders. The OrderComments table is only used on client databases. The MobiLink server processes the OrderComments tables using special events.

You also create a synchronization user, publication, and subscription on the client database.

♦  To set up your MobiLink client database
  1. Create your MobiLink client database.

    In this lesson, you create a SQL Anywhere database using the dbinit command line utility.

    • To create your SQL Anywhere database, run the following command:

      dbinit -I -k remote1

      The -I and -k options tell dbinit to omit jConnect support and Watcom SQL compatibility views, respectively.

    • To start the database server, run the following command:

      dbeng11 remote1
  2. Connect to your MobiLink client database using Interactive SQL.

    Run the following command:

    dbisql -c "eng=remote1;uid=DBA;pwd=sql"
  3. Create the RemoteOrders table.

    Execute the following command in Interactive SQL:

    create table RemoteOrders (
        order_id           integer not null,
        product_id         integer not null,
        quantity   integer,
        order_status       varchar(10) default 'new',
        primary key(order_id)
    )
  4. Run the following command in Interactive SQL to create the OrderComments table:

    create table OrderComments (
        comment_id         integer not null,
        order_id           integer not null,
        order_comment      varchar (255),
        primary key(comment_id),
        foreign key (order_id) references 
         RemoteOrders (order_id)
    )
  5. Create your MobiLink synchronization user, publication, and subscription:

    CREATE SYNCHRONIZATION USER ml_sales1;
    CREATE PUBLICATION order_publ (TABLE RemoteOrders, Table OrderComments);
    CREATE SYNCHRONIZATION SUBSCRIPTION TO order_publ FOR ml_sales1
     TYPE TCPIP ADDRESS 'host=localhost'
    Note

    You specify how to connect to the MobiLink server using the TYPE and ADDRESS clauses in the CREATE SYNCHRONIZATION SUBSCRIPTION statement.

    You can use publications to determine what data is synchronized. In this case you specify the entire RemoteOrders and OrderComments tables.

Further reading

For information about creating a SQL Anywhere database, see Initialization utility (dbinit).

For information about MobiLink clients, see MobiLink clients.

For information about creating MobiLink objects on the client, see: