Collection Contents Index Tutorial overview Setting up a consolidated database pdf/chap4.pdf

Data Replication with SQL Remote
   PART 1. Introduction to SQL Remote
     CHAPTER 4. A Tutorial for Adaptive Server Anywhere Users       

A tutorial using Sybase Central


The following sections are a tutorial describing how to set up a simple SQL Remote replication system in Adaptive Server Anywhere using Sybase Central.

You do not need to enter SQL statements if you are using Sybase Central to administer SQL Remote. A tutorial for those who do not have access to Sybase Central, or who prefer to work with command-line utilities, is presented in A tutorial using Interactive SQL and DBXTRACT, and contains the SQL statements executed behind the scenes by Sybase Central.

In this tutorial you act as the DBA of the consolidated database, and set up a simple replication system using the file-sharing message link. The simple example is a primitive model for a sales-force automation system, with two tables. One contains a list of sales representatives, and another a list of customers. The tables are replicated in a setup with one consolidated database and one remote database. You can install this example on one computer.

For Info     This tutorial assumes that you have some familiarity with Sybase Central. If you need help with Sybase Central, use the Sybase Central online Help.

Top of page  Preparing for the Sybase Central replication tutorial

This section describes the steps you need to take to prepare for the tutorial. These steps include the following:

  To prepare for the tutorial:
  1. Create a directory to hold the files you make during this tutorial; for example c:\tutorial.

    mkdir c:\tutorial
  2. Create a subdirectory for each of the two user IDs in the replication system, to hold their messages. Create these subdirectories using the following statements at a system command line:

    mkdir c:\tutorial\hq
    mkdir c:\tutorial\field
  3. The tutorial uses two databases: a consolidated database named hq.db and a remote database named field.db. At this point, you should create the hq database with the Create Database utility in Sybase Central:

    An Adaptive Server Anywhere database is simply a file, which can be copied to other locations and computers when necessary.

The next step is to add a pair of tables to the consolidated database.

  To add tables to the consolidated database:
  1. Connect to the hq database from Sybase Central, as user ID DBA using password SQL.

  2. Click the Tables folder of the hq database.

  3. Double-click Add Table, and use the Table Editor to create a table named SalesRep with the following columns:

    Key

    Column

    Data Type

    Size/Prec

    Primary key

    rep_key

    char

    5

    name

    char

    40

    You do not need to use the Advanced Properties window. The columns are created by default not allowing NULL.

  4. Double-click Add Table again, and use the Table Editor to create a table named Customer with the following columns:

    Key

    Column

    Data Type

    Size/Prec

    Primary key

    cust_key

    char

    10

    name

    char

    40

    rep_key

    char

    5

    Again, you do not need to use the Advanced Properties window. The columns are created by default not allowing NULL.

  5. Open the Foreign Keys folder of the Customer table container, and double-click Add Foreign Key. Using the Wizard, add a foreign key to the rep_key column of the SalesRep table. You can use the default settings for this foreign key.

You are now ready for the rest of the tutorial.

Top of page  

Collection Contents Index Tutorial overview Setting up a consolidated database pdf/chap4.pdf