In this lesson, you use a SQL Anywhere database for your consolidated database and your MobiLink client. For tutorial purposes your MobiLink client, consolidated database, and MobiLink server all reside on the same computer.
Prérequis
This lesson assumes you have completed all preceding lessons. See Lesson 1: Setting up an XML data source.
This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Synchronizing with XML.
Contexte et remarques
To set up the MobiLink client database, you create the RemoteOrders and OrderComments tables. The RemoteOrders table corresponds to the RemoteOrders table on the consolidated database. The MobiLink server uses SQL-based scripts to synchronize remote orders. The OrderComments table is only used on client databases. The MobiLink server processes the OrderComments tables using special events.
Create your MobiLink client database using the dbinit command line utility.
Navigate to c:\MLobjxml and then run the following command:
dbinit -i -k -dba DBA,sql remote1 |
The -i and -k options omit jConnect support and Watcom SQL compatibility views, respectively.
Start your MobiLink client database using the dbsrv16 command line utility.
Run the following command:
dbsrv16 remote1 |
Connect to your MobiLink client database using Interactive SQL.
Run the following command:
dbisql -c "SERVER=remote1;UID=DBA;PWD=sql" |
Create the RemoteOrders table.
Execute the following SQL statement in Interactive SQL:
CREATE TABLE RemoteOrders ( order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, quantity INTEGER, order_status VARCHAR(10) DEFAULT 'new', PRIMARY KEY(order_id) ); |
Create the OrderComments table.
Execute the following SQL statement in Interactive SQL:
CREATE TABLE OrderComments ( comment_id INTEGER NOT NULL, order_id INTEGER NOT NULL, order_comment VARCHAR(255), PRIMARY KEY(comment_id), FOREIGN KEY(order_id) REFERENCES RemoteOrders(order_id) ); |
Create your MobiLink synchronization user, publication, and subscription.
Execute the following SQL statement in Interactive SQL:
CREATE SYNCHRONIZATION USER ml_sales1; CREATE PUBLICATION order_publ (TABLE RemoteOrders, TABLE OrderComments); CREATE SYNCHRONIZATION SUBSCRIPTION TO order_publ FOR ml_sales1 TYPE TCPIP ADDRESS 'host=localhost'; |
You specify how to connect to the MobiLink server using the TYPE and ADDRESS clauses in the CREATE SYNCHRONIZATION SUBSCRIPTION statement.
You can use publications to determine what data is synchronized. In this case you specify the entire RemoteOrders and OrderComments tables.
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |