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

SQL Anywhere 11.0.0 » MobiLink - Getting Started » MobiLink Tutorials » Tutorial: Introduction to direct row handling


Lesson 5: 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 engine, 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 PUBLICATION order_publ (TABLE RemoteOrders, Table OrderComments);
     TYPE TCPIP ADDRESS 'host=localhost'

    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 Introducing MobiLink clients.

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