MobiLink is designed for synchronization involving a consolidated database server and a large number of mobile databases. In this section, you create two remote databases. For each database you:
Migrate a selected portion of the consolidated schema.
Create a synchronization publication, user, and subscription.
In Lesson 1, you used Sybase Central to create databases. In this tutorial, you use a command line utility. The two tools produce identical results.
At a command prompt, navigate to the directory where you would like to create the remote databases.
Type the following commands to create the database:
dbinit -p 4096 remote1.db |
For remote2, type:
dbinit -p 4096 remote2.db |
The -p option defines a 4K page size shown to increase performance for many environments.
For more information about dbinit options, see Initialization utility (dbinit).
Now, to start the databases, type:
dbeng11 remote1.db |
For remote2, type:
dbeng11 remote2.db |
Migrating a subset of the consolidated database schema involves:
Connecting to the remote database.
Creating a remote server and external login.
Using the Sybase Central Migrate Database Wizard.
Click Start » Programs » SQL Anywhere 11 » Sybase Central.
Connect to the remote database:
In the left pane, click SQL Anywhere 11.
Click File » Connect.
Click the Identification tab.
In the User ID field, type DBA.
In the Password field, type sql.
Click the Database tab.
In the Server Name field, type remote1.
Click OK.
Create a remote server:
In the left pane, right-click Remote Servers and choose New » Remote Server.
In the What Do You Want To Name The New Remote Server field, type my_sa. Click Next.
Click SQL Anywhere. Click Next.
In the What Is The Connection Information field, type sa_cons. Click Next.
Click Next.
Click Create An External Login For The Current User.
In the Login Name field, type DBA.
In the Password field, type sql.
In the Confirm Password field, type sql.
Click Finish.
Migrate the consolidated database schema:
Click Tools » SQL Anywhere 11 » Migrate Database.
Click Next.
In the To Which Database Do You Want To Migrate list, select remote1. Click Next.
In the From Which Remote Server Do You Want To Migrate list, select my_sa. Click Next.
In the Available Tables list, choose Product, and then click Add. Click Next.
Click DBA. Click Next.
Clear Migrate The Data. Click Finish.
Click Close.
Repeat steps 2 to 4 using the remote2 database.
Publications identify the tables and columns on your remote database that you want synchronized. These tables and columns are called articles. A synchronization subscription subscribes a MobiLink user to a publication.
Synchronization subscriptions and publications are stored in the remote database.
In the left pane of Sybase Central, right-click remote1 - DBA and choose File » Open Interactive SQL.
Enter synchronization information for remote1:
Execute the following in Interactive SQL:
CREATE PUBLICATION pub_1 (TABLE Product); CREATE SYNCHRONIZATION USER user_1; CREATE SYNCHRONIZATION SUBSCRIPTION TO pub_1 FOR user_1 TYPE TCPIP ADDRESS 'host=localhost' OPTION scriptversion='ver1'; |
Start Interactive SQL and connect to remote2.
Enter synchronization information for remote2.
Execute the following in Interactive SQL:
CREATE PUBLICATION pub_2 (TABLE Product); CREATE SYNCHRONIZATION USER user_2; CREATE SYNCHRONIZATION SUBSCRIPTION TO pub_2 FOR user_2 TYPE TCPIP ADDRESS 'host=localhost' OPTION scriptversion='ver1'; |
Now you have prepared the remote and consolidated databases. In the next lesson you write synchronization scripts. In Lesson 4 you run the synchronization.
For more information about defining publications and subscriptions, see Publishing data.
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |