In this tutorial, 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.
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.
You also create a synchronization user, publication, and subscription on the client database.
Create your MobiLink client database.
In this lesson, you create a SQL Anywhere database using the dbinit command line utility.
To create your SQL Anywhere database, run the following command:
dbinit -i -k remote1 |
The -i and -k options tell dbinit to omit jConnect support and Watcom SQL compatibility views, respectively.
To start the database server, run the following command:
dbeng11 remote1 |
Connect to your MobiLink client database using Interactive SQL.
Run the following command:
dbisql -c "eng=remote1;uid=DBA;pwd=sql" |
Create the RemoteOrders table.
Execute the following command 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) ) |
Run the following command in Interactive SQL to create the OrderComments table:
create table OrderComments ( order_id integer not null, comment_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:
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.
For information about creating a SQL Anywhere database, see Initialization utility (dbinit).
For information about MobiLink clients, see MobiLink clients.
For information about creating MobiLink objects on the client, see:
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |