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: Changing a schema using the script version clause

 

Lesson 2: Creating and configuring the remote database

In this lesson, you set up a remote database for synchronization.

Prérequis

This lesson assumes you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Changing a schema using the script version clause.

This lesson assumes you have completed all preceding lessons. See Lesson 1: Creating and configuring the consolidated database.

 Task
  1. Run the following commands to create a remote database and start it running.

    cd..
    md c:\remote
    cd c:\remote
    dbinit -dba DBA,sql remote.db
    dbsrv16 remote.db
  2. Open another instance of Interactive SQL and connect to remote.db.

    dbisql -c "SERVER=remote;DBF=remote.db;UID=DBA;PWD=sql"
  3. Execute the following SQL statement in Interactive SQL to create the table to be synchronized.

    CREATE TABLE customer (
       id      UNSIGNED INTEGER PRIMARY KEY,
       name    VARCHAR( 256),
       phone   VARCHAR( 12 )
    );
  4. Still using the Interactive SQL instance connected to the remote database, create a publication, MobiLink user, and subscription. The script version is associated with the subscription using the SCRIPT VERSION clause. This is very important since the schema upgrade procedure shown in this tutorial only works for subscriptions that have the script version set using the SCRIPT VERSION clause.



    CREATE PUBLICATION p1 (
          TABLE customer
    );
    
    CREATE SYNCHRONIZATION USER u1;
    
    CREATE SYNCHRONIZATION SUBSCRIPTION my_sub
    TO p1
    FOR u1
    SCRIPT VERSION 'my_ver1';

    After you have executed the SQL, leave Interactive SQL running and connected to the database as you will be running more SQL against the database as you work through the tutorial.

Résultat

The remote database is created and configured.