SQL Remote User's Guide
Tutorials for Adaptive Server Anywhere Users
Tutorial: Adaptive Server Anywhere replication using Interactive SQL and dbxtract
Set up the consolidated database
A publication is created using a CREATE PUBLICATION statement. This is a data definition language statement, and requires DBA authority. For the tutorial, you should connect to the hq database as user ID DBA, password SQL, to create a publication.
Create a publication named SalesRepData, which replicates all rows of the table SalesRep, and some of the rows of the table Customer.
To create the publication
Connect to the database from Interactive SQL, and execute the following statement:
CREATE PUBLICATION SalesRepData ( TABLE SalesRep, TABLE Customer SUBSCRIBE BY rep_key )
Each user ID that is to receive changes to the publication must have a subscription. The subscription can only be created for a user who has REMOTE permissions. The GRANT REMOTE statement contains the address to use when sending the messages.
To create the subscription
Connect to the database from Interactive SQL, and execute the following statement:
CREATE SUBSCRIPTION TO SalesRepData ('rep1') FOR field_user ;
The value rep1 is the rep_key value we will give to the user field_user in the SalesRep table.
The full CREATE SUBSCRIPTION statement allows control over the data in subscriptions; allowing users to receive only some of the rows in the publication. For more information, see CREATE SUBSCRIPTION statement.
The CREATE SUBSCRIPTION statement identifies the subscriber and defines what they receive. However, it does not synchronize data, or start the sending of messages.