Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

CREATE SYNCHRONIZATION SUBSCRIPTION statement [MobiLink]

Creates a subscription in a SQL Anywhere remote database between a MobiLink user and a publication.

Syntax
CREATE SYNCHRONIZATION SUBSCRIPTION[ subscription-name ]
TO publication-name
[ FOR ml-username, ... ]
[ TYPE network-protocol ]
[ ADDRESS protocol-options ]
[ OPTION option=value, ... ]
[ SCRIPT VERSION script-version ]
subscription-name : identifier
ml-username : identifier
network-protocol : http | https | tls | tcpip
protocol-options : string
value : string | integer
script-version : string
Parameters
  • subscription-name

    A unique name that you can use to identify this subscription. It is strongly recommended that you name all your subscriptions.

  • TO clause

    This clause specifies the name of a publication.

  • FOR clause

    This clause specifies one or more MobiLink user names. If you specify more than one user name, a separate subscription is created for each user. If you specify a subscription name, only one MobiLink user name can be specified.

    ml-username is a user who is authorized to synchronize with the MobiLink server.

    Omit the FOR clause to set the protocol type, protocol options, and extended options for a publication. If the FOR clause is omitted, you cannot specify a subscription name or use the SCRIPT VERSION clause.

  • TYPE clause

    This clause specifies the network protocol to use for synchronization. The default protocol is tcpip.

  • ADDRESS clause

    This clause specifies network protocol options such as the location of the MobiLink server. Multiple options must be separated by semicolons.

  • OPTION clause

    This clause allows you to set extended options for the subscription. If no FOR clause is provided, the extended options act as default settings for the publication.

  • SCRIPT VERSION clause

    This clause specifies the script version to use during synchronization. Typically, you must specify a new script version for each schema change you implement.

    You cannot use the SCRIPT VERSION clause if the FOR clause is omitted.

Remarks

If no subscription-name is specified, a unique name is generated. The generated subscription name is the same as the publication name, provided it is unique. Otherwise, a unique name is formed by adding a number to the end of the publication name, for example, pub001, pub002, and so on.

The network-protocol, protocol-options, and option values can be set in several places.

This statement causes options and other information to be stored in the ISYSSYNC system table. Anyone with privileges to view data in the SYSSYNC system view can view the information, which could include passwords and encryption certificates. To avoid this potential security issue, you can specify the information on the dbmlsync command line.

You must have exclusive access to all tables referenced in the publication to execute the statement.

Privileges

You must have the SYS_REPLICATION_ADMIN_ROLE system role.

Side effects

Automatic commit.

Standards
  • ANSI/ISO SQL Standard

    Not in the standard.

Example

The following example creates a subscription named sales between the MobiLink user SSinger and the publication called sales_publication owned by user. When the subscription is synchronized, the script version sales_v1 is used and tables are locked in exclusive mode:

CREATE SYNCHRONIZATION SUBSCRIPTION sales
TO user.sales_publication
FOR SSinger
OPTION locktables='exclusive'
SCRIPT VERSION 'sales_v1'

The following example omits the FOR clause and stores settings for the publication called sales_publication:

CREATE SYNCHRONIZATION SUBSCRIPTION
TO user.sales_publication
ADDRESS 'host=test.internal;port=2439'
OPTION locktables=exclusive';