Creating remote databases
Any ASA database can be converted for use as a remote database
in a MobiLink installation. You can also create a new ASA remote
database that uses all or part of the schema of the consolidated
ASA database.
You create the database on your desktop using the Sybase Central
Adaptive Server Anywhere plug-in, the Create ASA Database utility
in the Database painter, or another tool. If your database uses
an English character set, use the 1252 Latin1 collation sequence.
To use a database as a remote database for MobiLink synchronization,
you need to create at least one publication and MobiLink user, then
add a subscription to the publication for the user. See “Creating and modifying publications”, “Creating MobiLink users”, and “Adding subscriptions”.
Remote database schemas
Tables in a remote database need not be identical to those
in the consolidated database, but you can often simplify your design
by using a table structure in the remote database that is a subset
of the one in the consolidated database. Using this method ensures
that every table in the remote database exists in the consolidated
database. Corresponding tables have the same structure and foreign
key relationships as those in the consolidated database.
Tables in the consolidated database frequently contain extra
columns that are not synchronized. Extra columns can even aid synchronization.
For example, a timestamp column can identify new or updated rows
in the consolidated database. In other cases, extra columns or tables
in the consolidated database might hold information that is not
required at remote sites.
For more information about the relationship between consolidated
and remote databases, see the MobiLink Synchronization
User’s Guide
.
Creating and modifying publications
You create publications using Sybase Central or the SQL CREATE PUBLICATION statement.
In Sybase Central, all publications and articles appear in the Publications
folder. This section describes how to create publications in Sybase
Central. For information about creating and modifying publications
using SQL, see the MobiLink
Synchronization User’s Guide
.
Connecting to Sybase Central
You use the Adaptive Server Anywhere plug-in in Sybase Central,
not the MobiLink Synchronization plug-in, to work with MobiLink
clients and remote databases. The Adaptive Server Anywhere plug-in
has a MobiLink Synchronization Client folder where you perform all
actions related to remote databases. For information on starting
Sybase Central from the PowerBuilder design time environment, see
the User’s Guide
.
You must have DBA authority to create or modify publications,
MobiLink users, and subscriptions.
To connect to Sybase Central to work with MobiLink
Synchronization clients:
-
Start Sybase Central, select Tools>Connect
from the Sybase Central menu bar, select Adaptive Server Anywhere
from the New Connection dialog box, and click OK. -
On the Identification page in the Connect dialog
box, enter DBA as the user name and SQL as
the password, select the ODBC DataSource Name radio button, browse
to select the remote database, and click OK. -
In the Adaptive Server Anywhere plug-in, expand
the node for the remote database and open the MobiLink Synchronization
Client folder.
Publishing all the rows and
columns in a table
The simplest publication you can create is a single article
that consists of all rows and columns of one or more tables. The
tables must already exist.
To publish one or more entire tables in Sybase
Central:
-
Connect to Sybase Central as described
in “Connecting to Sybase Central”. -
Open the Publications folder and double-click
Add Publication. -
Type a name for the new publication and click
Next. -
On the Tables page, select a table from the list
of Matching Tables and click Add.The table appears in the list of Selected Tables on the right.
-
Optionally, add more tables. The order of the
tables is not important. -
Click Finish.
Publishing only some columns in a table
You can create a publication that contains all the rows but
only some of the columns of a table.
To publish only some columns in a table in Sybase
Central:
-
Follow the first four steps of the procedure
in “Publishing all the rows and
columns in a table”. -
On the Columns page, double-click the table’s
icon to expand the list of available columns, select each column
you want to publish, and click Add.The selected columns appear on the right.
-
Click Finish.
Publishing only some rows in a table
You can create a publication that contains some or all of
the columns in a table, but only some of the rows. You do so by
writing a search condition that matches only the rows you want to
publish.In MobiLink, you can use the WHERE clause
to exclude the same set of rows from all subscriptions to a publication.
All subscribers to the publication upload any changes to the rows
that satisfy the search condition.
To create a publication using a WHERE clause in
Sybase Central:
-
Follow the first four steps of the procedure
in “Publishing all the rows and
columns in a table”. -
On the Where page, select the table and type the
search condition in the lower box.Optionally, you can use the Insert dialog box to help you
format the search condition. -
Click Finish.
Adding articles
You can add articles to existing publications.
To add articles in Sybase Central:
-
Connect to Sybase Central and open the
MobiLink Synchronization Client folder as described in “Connecting to Sybase Central”. -
Open the Publications folder and double-click
the name of the publication to which you want to add an article. -
Double-click Add Article.
-
In the Article Creation wizard, select a table
and click Next. -
If you want only some columns to be synchronized,
select the Selected Columns radio button and select the columns. -
If you want to add a WHERE clause,
click Next and enter the clause. -
Click Finish.
Modifying and removing publications and articles
You can modify or drop existing publications in Sybase Central
by navigating to the location of the publication and selecting Properties
or Delete from its pop-up menu. You can modify and remove articles
in the same way.
Publications can be modified only by the DBA or the publication’s
owner. You must have DBA authority to drop a publication. If you
drop a publication, all subscriptions to that publication are automatically
deleted as well.
Avoid altering publications in a running MobiLink setup Altering publications in a running MobiLink setup is likely
to cause replication errors and can lead to loss of data unless
carried out with care.
Creating MobiLink users
MobiLink users are not the same as database users. Each type
of user resides in a different namespace. MobiLink user IDs can
match the names of database users, but there is no requirement that
they match.
To add a MobiLink user to a remote database in
Sybase Central:
-
Connect to Sybase Central and open the
MobiLink Synchronization Client folder as described in “Connecting to Sybase Central”. -
Open the MobiLink Users folder and double-click
Add MobiLink User. -
Enter a name for the MobiLink user.
The name is supplied to the MobiLink synchronization server
during synchronization. In production databases, each user name
is usually added to the consolidated database, then provided to
the individual user. -
Click Finish.
To configure MobiLink user properties in Sybase
Central:
-
Connect to Sybase Central and open the
MobiLink Synchronization Client folder as described in “Connecting to Sybase Central”. -
Open the MobiLink Users folder, right-click the
MobiLink user, and selectProperties from the pop-up menu.
-
Change the properties as needed.
To drop a MobiLink user in Sybase Central:
-
Connect to Sybase Central and open the
MobiLink Synchronization Client folder as described in “Connecting to Sybase Central”. -
Open the MobiLink Users folder, right-click the
MobiLink user, and selectDelete from the pop-up menu.
Dropping MobiLink users You must drop all subscriptions for a MobiLink user before
you drop the user from a remote database.
Adding MobiLink users
to the consolidated database
The consolidated database contains a table called ml_user that
is used to authenticate the names of MobiLink users when a synchronization
is requested. When you add a user to a remote database, you need
to be sure that the user is also added to the ml_user table.
You can add users automatically by selecting the Automatic
Addition of Users check box in the MobiLink Synchronization Server
Options dialog box and then starting the server. You open this dialog
box from the Utilities folder in the Database painter or Database
Profiles dialog box. You can also start the server from a command
prompt, passing it the -zu+ switch.
Any users defined in the remote database are added to the ml_user table
in the consolidated database, as long as the script for the authenticate_user connection
event is undefined. Typically the -zu+ switch
is not used in a production environment. Names are usually added
to the ml_user table in the consolidated
database, then added to each of the remote databases. Each user is
given a unique name and optional password.
Adding subscriptions
A synchronization subscription links a particular MobiLink
user with a publication. It can also carry other information needed
for synchronization. For example, you can specify the address of
the MobiLink server and other connection options. Values for a specific
subscription override those set for individual MobiLink users.
Overriding options in the wizard You can override the MobiLink server name and port set for
the subscription and user in the MobiLink Synchronization for ASA
wizard.
Synchronization subscriptions are required in MobiLink ASA
remote databases. Server logic is implemented through synchronization
scripts, stored in the MobiLink system tables in the consolidated
database.
A
single ASA database can synchronize with more than one MobiLink synchronization
server. To allow synchronization with multiple servers, create different
subscriptions for each server.
To add a subscription for a MobiLink user in Sybase
Central:
-
Connect to Sybase Central and open the
MobiLink Synchronization Client folder as described in “Connecting to Sybase Central”. -
Open the MobiLink Users folder, right-click the
user for whom you want to add a subscription, and select Properties
from the pop-up menu. -
On the Subscriptions page, click the Subscribe
button. -
Select the Publication for which you want to add
a subscription and click OK.
To modify a subscription in Sybase Central:
-
Connect to Sybase Central and open the
MobiLink Synchronization Client folder as described in “Connecting to Sybase Central”. -
Open the MobiLink Users folder, right-click the
MobiLink user, and select Properties from the pop-up menu. -
On the Subscriptions page, select the subscription
you want to change and click Advanced. -
Change the properties as needed.
To delete a synchronization subscription in Sybase
Central:
-
Connect to Sybase Central and open the
MobiLink Synchronization Client folder as described in “Connecting to Sybase Central”. -
Open the MobiLink Users folder, right-click the
MobiLink user, and select Properties from the pop-up menu. -
On the Subscriptions page, select the subscription
you want to delete and click Unsubscribe.