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

SQL Anywhere 12.0.0 » MobiLink - Getting Started » MobiLink Tutorials » Tutorial: Changing a schema using the ScriptVersion extended option


Lesson 1: Create and configure the consolidated database

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

 To create and configure a consolidated database
  1. Run the following commands to create a consolidated database and start it running:

    md c:\cons
    cd c:\cons
    dbinit consol.db
    dbeng12 consol.db
  2. Run the following command to define an ODBC data source for the consolidated database:

    dbdsn -w dsn_consol -y -c "uid=DBA;pwd=sql;dbf=consol.db;server=consol"
  3. To use a database as a consolidated database, you must run a setup script that adds system tables, views, and stored procedures that are used by MobiLink. The following command sets up consol.db as a consolidated database:

    dbisql -c "dsn=dsn_consol" %SQLANY12%\MobiLink\setup\syncsa.sql
  4. Open Interactive SQL and connect to consol.db using the dsn_consol DSN.

    dbisql -c "dsn=dsn_consol"
  5. Run the following SQL statements in Interactive SQL. They create the customer table on the consolidated database and create the required synchronization scripts.

    CREATE TABLE customer (
       id      unsigned integer primary key,
       name    varchar( 256),
       phone   varchar( 12 )
    CALL ml_add_column('my_ver1', 'customer', 'id', null );
    CALL ml_add_column('my_ver1', 'customer', 'name', null );
    CALL ml_add_column('my_ver1', 'customer', 'phone', null );
    CALL ml_add_table_script( 'my_ver1', 'customer', 'upload_insert',
          'INSERT INTO customer ( id, name, phone ) ' 
          || 'VALUES ({ml}, {ml}, {ml} )' );
    CALL ml_add_table_script( 'my_ver1', 'customer', 'download_cursor',
           'SELECT id, name, phone from customer' );
    CALL ml_add_table_script( 'my_ver1', 'customer', 'download_delete_cursor', '--{ml_ignore}' );

    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.

  6. Start the MobiLink server by running the following command:

    start mlsrv12 -c "dsn=dsn_consol" -v+ -ot mlsrv.txt -zu+