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

SQL Anywhere 12.0.1 » MobiLink - Client Administration » SQL Anywhere clients for MobiLink » Scripted upload » Tutorial: Using scripted upload


Lesson 2: Creating the remote database

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

 Create a remote database
  1. At a command prompt in your samples directory, run the following command to create a remote database:

    dbinit remote.db
  2. Next, run the following command to define an ODBC data source:

    dbdsn -w dsn_remote -y -c "UID=DBA;PWD=sql;DBF=remote.db;SERVER=remote"
  3. To open Interactive SQL and connect to remote.db using the dsn_remote, run the following command:

    dbisql -c "DSN=dsn_remote"
  4. Run the following set of statements to create objects in the remote database:

    First, create the table to be synchronized. The insert_time and delete_time columns are not synchronized but contain information used by the upload stored procedures to determine which rows to upload.

    CREATE TABLE employee (
         id            unsigned integer primary key,
         name          varchar( 256),
         salary        numeric( 9, 2 ),
         insert_time   timestamp default '1900-01-01'

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

  5. Proceed to Lesson 3: Handling inserts.

Next, you need to define stored procedures and other things to handle the upload. You do this separately for inserts, deletes, and updates.