exec sp_grant_remote field_user, file, field go

As with the publisher address, the address of the remote user (field ) is a directory relative to the SQLRemote environment variable or registry entry. As you have not set this value, the address is taken relative to the directory from which the Message Agent is run. You should run the Message Agent from your tutorial directory for the addresses to be interpreted properly.

For information about setting the SQLRemote value, see “Setting message type control parameters” on page 214 .

Create the publication and subscription

The remaining task is to define the data to be replicated. To do this, you must first create a publication, which defines the available data, and then create a subscription for field_user , which defines the data that user is sharing.

In Adaptive Server Enterprise, they are created with the

sp_create_publication procedure, which creates an empty publication, and the sp_add_article procedure, which adds articles to the procedure. Also, each table must be marked for replication before it can be included in a publication.

To create the publication

1. Create an empty publication:

exec sp_create_publication SalesRepData go

2. Mark both the SalesRep table and the Customer table for publication:

exec sp_add_remote_table SalesRep go

exec sp_add_remote_table Customer go

3. Add the whole SalesRep table to the SalesRepData publication:

exec sp_add_article SalesRepData, SalesRep go

4.Add the Customer table to the SalesRepData publication, using the

rep_key column to partition the table. The following statement should be typed all on one line, except for the go:

exec sp_add_article SalesRepData, Customer, NULL, ’rep_key’ go

62

Page 80
Image 80
Sybase DC38133-01-0902-01 manual Create the publication and subscription, Create an empty publication