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
In the hierarchical replication system supported by SQL Remote, each database may have one consolidated database immediately above it in the hierarchy and many databases immediately below it on the hierarchy (remote databases).
PUBLISH permission identifies the current database for outgoing messages, and the REMOTE permission identifies each database receiving messages from the current database.
Permissions can only be granted by a user with DBA authority. To carry out these examples you should connect using the Interactive SQL utility to hq as user ID DBA, with password SQL.
Each database that distributes its changes to other databases in the replication system is a publisher database. Each database in the replication system that publishes changes to a database is identified by a single user ID. You set that ID for your database using the GRANT PUBLISH statement. This section describes setting permissions for the consolidated database (hq.db).
To create a publisher for the database
Connect to the database using Interactive SQL, and type the following statement:
GRANT CONNECT TO hq_user IDENTIFIED BY hq_pwd ; GRANT PUBLISH TO hq_user ;
You can check the publishing user ID of a database at any time using the CURRENT PUBLISHER special constant:
SELECT CURRENT PUBLISHER
Each remote database is identified using the GRANT REMOTE statement. Whether the remote database is a personal server or a network server with many users, it needs a single user ID to represent it to the consolidated database.
In a mobile workgroup setting, remote users may already be users of the consolidated database, and so this would require no extra action on the part of the DBA.
The GRANT REMOTE statement identifies the message system to be used when sending messages to the recipient, as well as the address.
To add a remote user
Connect to the database using Interactive SQL, and execute the following statements:
GRANT CONNECT TO field_user IDENTIFIED BY field_pwd ; GRANT REMOTE TO field_user TYPE file ADDRESS 'field' ;
The address string is the directory used to hold messages for field_user, enclosed in single quotes. It is taken 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.