Contents Index Introduction Lesson 2: Running the MobiLink synchronization server

MobiLink Synchronization User's Guide
  Tutorial: Synchronizing Adaptive Server Anywhere Databases

Lesson 1: Creating and populating your databases


MobiLink synchronization requires that you have data in a relational database, an ODBC data source for each database, and two compatible databases.

Create your database files 

The first step is to create each of the databases. In this procedure, you build a consolidated database and a remote database using the dbinit utility from a command line.

The dbinit utility creates a database file with no user tables or procedures. You create your database schema when you define, within the newly-initialized file, user-defined tables and procedures.

To create your database files

  1. Open a command prompt and navigate to the Samples\MobiLink\AutoScripting subdirectory of your SQL Anywhere 9 installation.

  2. Create a consolidated database for this tutorial. Run the following command line:

    dbinit consol.db

    If this tutorial has been previously run on your computer, consol.db and consol.log may already exist. This will cause dbinit to fail. Delete these files before running dbinit.

  3. Create the remote database for this tutorial. Run the following command line:

    dbinit remote.db

    If this tutorial has been previously run on your computer, remote.db and remote.log may already exist. This will cause dbinit to fail. Delete these files before running dbinit.

  4. Verify the successful creation of these database files by listing the contents of the directory. You should see consol.db and remote.db in the listing.

Create ODBC data sources 

You are now ready to build ODBC data sources through which you can connect to your Adaptive Server Anywhere databases.

For more information about creating ODBC data sources, see The Data Source utility.

To create ODBC data sources

  1. Open a command prompt and navigate to the Samples\MobiLink\AutoScripting subdirectory of your SQL Anywhere 9 installation.

  2. Create your ODBC data source for a consolidated database by running the following command line:

    dbdsn -w test_consol -y -c "uid=DBA;pwd=SQL;dbf=consol.db;eng=Consol"

    This command line specifies the following options:

  3. Create an ODBC data source for a remote database by running the following command line:

    dbdsn -w test_remote -y -c "uid=DBA;pwd=SQL;dbf=remote.db;eng=Remote"
  4. Verify the successful creation of your data sources as follows.

To verify your new data sources

  1. Choose Start > Programs > Sybase SQL Anywhere 9 > Adaptive Server Anywhere > ODBC Administrator.

    The ODBC Data Source Administrator appears.

  2. Click the User DSN tab.

  3. Scroll through the list to find the test_remote and test_consol data sources.

  4. Select each data source and click Configure.

  5. Test your data source by clicking the Test Connection button.

  6. Click OK to close the ODBC Data Source Administrator.

Create your schema 

The following procedure executes SQL statements using the Interactive SQL utility to create and populate tables in the consolidated database. It also creates tables and inserts synchronization subscriptions and publications into the remote database.

The SQL files, build_consol.sql and build_remote.sql, are created specifically for this tutorial.

To call and run your scripts using Interactive SQL

  1. Open a command prompt and navigate to the Samples\MobiLink\AutoScripting subdirectory of your SQL Anywhere 9 installation.

  2. Run the following command line:

    dbisql -c "dsn=test_consol;astop=no" build_consol.sql

    The SQL statements in build_consol.sql create and populate the emp and cust tables in the consolidated database.

    This step includes astop=no to instruct the server not to shut down when the dbisql utility shuts down.

  3. Run the following command line:

    dbisql -c "dsn=test_remote;astop=no" build_remote.sql

    The SQL statements in build_remote.sql create the remote tables emp and cust, and insert synchronization subscriptions and publications.

  4. Verify the creation of the emp and cust tables in the remote and consolidated databases using Interactive SQL.

  5. Leave the consolidated and remote databases running for the next lesson.

Further reading 

For more information about creating remote databases, see Creating a remote database.

For more information about creating subscriptions and publications, see Publishing data.

For more information about creating databases, see The Initialization utility and Creating a database using the dbinit command-line utility.

For more information about running Interactive SQL, see The Interactive SQL utility and Using Interactive SQL.

For more information about SELECT statements, see SELECT statement.


Contents Index Introduction Lesson 2: Running the MobiLink synchronization server