Granting and revoking PUBLISH permissions

When a database sends a message, a user ID representing that database is included with the message to identify its source to the recipient. This user ID is the publisher user ID of the database. A database can have only one publisher. You can find out who the publisher of a SQL Anywhere database is at any time in Sybase Central by opening the Users & Groups folder.

A publisher is required even for read-only remote databases within a replication system, as even these databases send confirmations to the consolidated database to maintain information about the status of the replication. The GRANT PUBLISH statement for remote SQL Anywhere databases is carried out automatically by the database extraction utility.

Granting and revoking PUBLISH permissions from Sybase Central

You can grant PUBLISH permissions on a SQL Anywhere database from Sybase Central. You must connect to the database as a user with full system or database administrator permissions.

To create a new user as the publisher (Sybase Central)

  1. In the left pane, select the Users & Groups folder.

  2. From the File menu, choose New » User.

    The Create User Wizard appears.

  3. Follow the instructions in the wizard. Ensure that the user has a password and is granted Remote DBA authority; this enables the user ID to run the Message Agent.

  4. Click Finish to create the user.

  5. In the Users & Groups folder, right-click the user you just created and choose Change To Publisher from the popup menu.

To make an existing user the publisher (Sybase Central)

  • In the Users & Groups folder, right-click a user and choose Change To Publisher from the popup menu.

You can also revoke PUBLISH permissions from Sybase Central.

To revoke PUBLISH permissions (Sybase Central)

  • In the Users & Groups folder, right-click the user who has granted PUBLISH permissions and choose Revoke Publisher from the popup menu.

Granting and revoking PUBLISH permissions

For SQL Anywhere, PUBLISH permissions are granted using the GRANT PUBLISH statement:

GRANT PUBLISH TO userid;

The userid is a user with CONNECT permissions on the current database. For example, the following statement grants PUBLISH permissions to user S_Beaulieu:

GRANT PUBLISH TO S_Beaulieu;

The REVOKE PUBLISH statement revokes the PUBLISH permissions from the current publisher:

REVOKE PUBLISH FROM userid;
Notes on PUBLISH permissions
  • To see the publisher user ID outside Sybase Central, use the CURRENT PUBLISHER special constant. The following statement retrieves the publisher user ID:
    SELECT CURRENT PUBLISHER;
  • If PUBLISH permissions is granted to a user ID with GROUP permissions, it is not inherited by members of the group.
  • PUBLISH permissions have no authority except to identify the publisher in outgoing messages.
  • For messages sent from the current database to be received and processed by a recipient, the publisher user ID must have REMOTE or CONSOLIDATE permissions on the receiving database.
  • The publisher user ID for a database cannot also have REMOTE or CONSOLIDATE permissions on that database. This would identify them as both the sender of outgoing messages and a recipient of such messages.
  • Changing the user ID of a publisher at a remote database will cause serious problems for any subscriptions that database is involved in, including loss of information. You should not change a remote database publisher user ID unless you are prepared to resynchronize the remote user from scratch.
  • Changing the user ID of a publisher at a consolidated database while a SQL Remote setup is operating will cause serious problems, including loss of information. You should not change the consolidated database publisher user ID unless you are prepared to close down the SQL Remote setup and resynchronize all remote users.