To enable a group of users to access the data and files that its members require, you must define one or more replication subscriptions. A replication subscription provides specifications for how the information in a source system (an enterprise server) is to be synchronized with a target system (the mobile device).
You can create several types of subscriptions in the Mobile Devices Administration Center: DataPropagator subscriptions, JDBC subscriptions, upload subscriptions, file subscriptions, and custom subscriptions.
To determine which subscriptions you need to create, evaluate what information your groups of mobile users currently require to perform their work. What data do their applications access? What files do they view or use regularly?
Use the Create JDBC Subscription notebook to create a JDBC table subscription.
Each table subscription that you create can reference one or more tables.
To create a JDBC subscription:
After authenticating a user, the Sync Server determines what group the user belongs to, then queries the administration control database to determine what subscription is involved in the request. For this reason, the Sync Server must be able to uniquely identify each subscription by name.
To identify a JDBC subscription:
On the Identification page, fill in these fields:
Encryption support for Windows CE and Win32 platforms is only available with the Microsoft High Encryption Pack available from Microsoft. The Microsoft High Encryption Pack must be installed to use encryption between Windows CE/Pocket PC clients or Win32 platform clients and the DB2 Everyplace Sync Server. Encryption support on Palm OS requires Palm OS 3.3 or later.
To specify the encryption level:
On the Identification page, select the encryption level using the Encryption level field. The following three options are available:
You must specify the source and mirror databases. For upload subscriptions, no mirror database is required.
To specify the source database driver and URL
On the Source page of the Create JDBC Subscription notebook, provide the following information:
Click Test connection to verify the source database settings.
You need to specify the mirror database for a synchronizing subscription, but not for a upload subscription.
To specify the mirror database driver and URL
On the Mirror page of the Create JDBC Subscription notebook, provide the following information:
Click Test connection to verify the database settings.
You must define at least one table for every JDBC subscription. If you specified more than one table for the subscription, these tables will be synchronized in the same order that you added them when you created the subscription. The list of tables on the Define Replication Subscription window shows this order.
You must not specify the same source and target tables in two different subscriptions. If you want to create two subscriptions that replicate the same source table, use different target tables.
To add a table to the subscription
Click Filter to change the source filter used to limit the available tables in the table list. The Filter window opens.
The % symbol is a wildcard. Typing % in the Source schema and Source table fields displays all available tables in the table list.
When you create a subscription to a particular table (the PATIENTS table for your group of visiting nurses, for example), performance considerations might force you to replicate only a subset of the data in the table. You specify this subset by choosing individual rows or columns to be replicated for each table in the subscription.
For example, you might decide that the only columns relevant for visiting nurses using the PATIENTS table are the PATIENT_NAME, ADDRESS, PHONE, and DOCTOR fields. You might then decide to further filter the data by defining a WHERE clause that filters data for nurses working for a particular doctor.
You can combine data filters for the subscription with filters set for the group or for individual users to pare down the data even further.
To filter the data that will be replicated during synchronization
Note: | The source table primary key columns must be subscribed. If the source table has columns which are not part of the primary key, at least one of those columns must be subscribed. |
For example, suppose you want your visiting nurses to see only the rows of data in the PATIENTS table where the value of the JOBCODE column is VNURSE. You would enter the following WHERE clause:
JOBCODE='VNURSE'
It is not necessary to type WHERE at the beginning of the clause.
For example, suppose that you want users to see only data related to their own job codes. Instead of hard-coding a value for the JOBCODE parameter for the entire subscription, define a variable that references the data filter value defined for each individual user:
JOBCODE=':JOB.'
In the data filters for individual users, you could then set the :JOB parameter to each user's job code. See Filtering the data available to the user and Horizontal filtering at the subscription level, group level, or user level for more information on filtering data for individual users.
Note: | A series of changes made to a single row in a DB2 Everyplace table on the user's device between synchronizations will be communicated to the Sync Server as a single cumulative change. As a result, a DELETE operation followed by an INSERT operation for the same primary key will be communicated to the SyncServer as an UPDATE operation if the operations occur with no intervening synchronizations. If they occur with an intervening synchronization, then they are communicated separately. Doing a series of changes to a single row can lead to an inconsistency because the subscription does not transfer all columns between the source table and the user table. An UPDATE operation will retain the current values in the unsubscribed column(s), while the INSERT will set the unsubscribed columns to default values. |
For performance reasons, you probably do not want the Sync Server to perform replication for every synchronization request the moment that it queues. To improve performance, you can do one of the following:
When batching synchronization requests, the Sync Server begins replicating synchronization requests when the number of seconds defined for the batch window has elapsed since the last replication.
For information about how to set the Sync Server to perform replication at any given time, see Replicating on demand.
To batch synchronization requests:
All subscriptions defined against the same mirror database share the same values for batch parameters. Any changes that you make affect all subscriptions defined against the mirror database.
After you define the subscription, you must specify what subscription sets use it. When you associate a subscription with a subscription set, you can then assign the subscription set to a group to provide members of the group access to the data and files defined in the subscriptions the subscription set references.
One subscription can be used by an unlimited number of subscription sets. However, two subscriptions that are defined with different privileges cannot belong to the same subscription set.
If two subscriptions with different privileges synchronize with the same table, they must use different mirroring (mid-tier) servers. Two subscriptions with different privileges can use the same mirror only if they synchronize with different tables.
To specify the subscription sets that use this subscription
If no subscription sets appear in the Available subscription sets list, click Create to create a subscription set without closing the current JDBC Subscription notebook. The Create Subscription Set notebook opens.
A DataPropagator subscription provides specifications for how data in a source table is to be synchronized to a table on the mobile device.
Each subscription that you create can reference one or more tables.
To create a DataPropagator subscription:
For example, do you want all data in the source table to be replicated in every synchronization? Only certain rows? The data filtering you specify for the subscription applies to all groups that use the subscription.
Most of these steps are explained in more detail in this section.
After authenticating a user, the Sync Server determines the group that the user belongs to, then queries the administration control database to determine what subscription is involved in the request. For this reason, the Sync Server must be able to uniquely identify each subscription by name.
To identify a DataPropagator subscription, provide information in the following fields on the Identification page of the Create DataPropagator subscription notebook:
For DB2 DataPropagator subscriptions, the system converts the name that you specify here to uppercase upon saving it in the administration control database. After the name is saved in the control database, you cannot rename the subscription because this function is not supported by DB2 DataPropagator. You must first delete the existing subscription, then create a new subscription with the new name.
Type up to 128 characters of text that describes this subscription.
Encryption support for Windows CE and Win32 platforms is only available with the Microsoft High Encryption Pack available from Microsoft. The Microsoft High Encryption Pack must be installed to use encryption between Windows CE/Pocket PC clients or Win32 platform clients and the DB2 Everyplace Sync Server. Encryption support on Palm OS requires Palm OS 3.3 or later.
To specify the encryption level:
On the Identification page, select the encryption level using the Encryption level field. After the encryption level is modified, all users subscribing to that subscription must be reset. The following three options are available:
The source database is the database serving as the source for data replication.
The target database is the database on the mobile device receiving replicated data from a source system.
To map the source database on the enterprise system to its target database on the mobile device, provide information in the following fields on the Identification page of the Create DataPropagator subscription notebook:
The source database must be cataloged. Choose a name from a list of
cataloged databases by clicking the
push button.
This field automatically defaults to the name that you typed in the Source database field. You can override this target database name only if this is the first subscription defined against this source database.
This field does not apply to devices running Palm OS, because that operating system does not use a traditional database structure.
Before you begin setting up synchronization, you must create the mirror database on the mid-tier system. You can create the mirror database by clicking the Create button to launch the Create Database wizard. You can then identify the mirror database in the subscription.
To identify the mirror database, choose a mirror database name from the list in the Mirror database field on the Identification page of the Create DataPropagator subscription notebook. This field displays all databases defined on the server where you invoked the Mobile Devices Administration Center.
A replication source is a table residing on a source system from which data is replicated to a target system. You must define at least one replication source for every DataPropagator subscription. You must not specify the same source and target tables in two different subscriptions. If you want to create two subscriptions that replicate the same source table, use different target tables.
If you specified more than one table for the subscription, these tables will be synchronized in the same order that you added them when you created the subscription. The list of tables on the Define Replication Subscription window shows this order.
To add a replication source to the subscription:
Because replication sources can be used and managed by tools other than the DB2 Everyplace Sync Server, when you define the source ensure that you control access to the data in a way that all applications can take advantage of.
The Subscription name field reflects the name of the subscription that you entered on the Identification page. The Apply qualifier field represents a unique qualifier that the Sync Server uses for all subscriptions defined for this database.
The Apply qualifier streamlines the process of synchronizing the mid-tier mirror database with its master database on the enterprise system; when the Apply program runs, DataPropagator replicates data for all subscriptions with the same Apply qualifier. The Apply qualifier defaults to the name of the mirror database.
After you add a replication source to the subscription, you can change only the SQL access privileges defined for the source.
Within the same subscription, a source table can be mapped to more than one target table name. However, DB2 DataPropagator uses a single change data table to replicate changes to and from both target tables.
When you create a subscription to a particular table (the PATIENTS table for your group of visiting nurses, for example), performance considerations might force you to replicate only a subset of the data in the subscription. You specify this subset by choosing individual rows to be replicated for each table in the subscription.
For example, you might decide that the only columns relevant for visiting nurses using the PATIENTS table are the PATIENT_NAME, ADDRESS, PHONE, and DOCTOR fields. You might then decide to further filter the data by defining a WHERE clause that filters data for nurses working for a particular doctor.
You can combine data filters for the subscription with filters set for the group or for individual users to pare down the data even further.
To filter the data that will be replicated during synchronization:
For example, suppose you want your visiting nurses to see only the rows of data in the PATIENTS table where the value of the JOBCODE column is VNURSE. You could enter the following WHERE clause:
JOBCODE='VNURSE'
The WHERE keyword must not be used at the beginning of the clause.
You can click Examples to display sample WHERE clauses.
For example, suppose that you want users to see only data related to their own job codes. Instead of hard-coding a value for the JOBCODE parameter for the entire subscription, define a variable that references the data filter value defined for each individual user:
JOBCODE=':JOB.'
In the data filters for individual users, you could then set the :JOB parameter to each user's job code. See Filtering the data available to the user and Horizontal filtering at the subscription level, group level, or user level for more information on filtering data for individual users.
Note: | A series of changes made to a single row in a DB2 Everyplace table on the user's device between synchronizations will be communicated to the Sync Server as a single cumulative change. As a result, a DELETE followed by an INSERT for the same primary key will be communicated to the SyncServer as an UPDATE, if the operations occur with no intervening synchronizations. If they occur with an intervening synchronization, then they are communicated separately. This can lead to an inconsistency when the subscription does not transfer all columns between the source table and the user table, as an UPDATE will retain the current values in the unsubscribed column(s), while the INSERT will set the unsubscribed columns to default values. |
For performance reasons, you probably do not want the Sync Server to perform replication for every synchronization request the moment that it queues. To improve performance, you can do one of the following:
When batching synchronization requests, the Sync Server begins replicating synchronization requests when the number of seconds defined for the batch window has elapsed since the last replication.
For information about how to set the Sync Server to perform replication at a given time, see Replicating on demand.
To batch synchronization requests:
All subscriptions defined against the same mirror database share the same values for batch parameters. Any changes that you make affect all subscriptions defined against the mirror database.
All subscriptions defined against a source database share the same user ID and password to gain access to the database. If this is the first subscription created against the source database, you need to specify this user ID and password. To do this, type the following values on the Authentications page of the Create DataPropagator subscription notebook:
The Sync Server creates a password file from this information that DataPropagator uses to access the source database. The password file is stored in the directory where the Sync Server runs.
After you define the subscription, you must specify the subscription sets that use it. When you associate a subscription with a subscription set, you can then assign the subscription set to a group to provide members of the group access to the data and files defined in the subscriptions that the subscription set references.
One subscription can be used by an unlimited number of subscription sets. However, two subscriptions that are defined with different privileges cannot belong to the same subscription set.
If two subscriptions with different privileges point to the same table, they must use different mirroring (mid-tier) servers. Two subscriptions with different privileges can use the same mirror only if they synchronize with different tables.
To specify the subscription sets that use this subscription:
If no subscription sets are displayed in the Available subscription sets list, you will need to create a subscription set. You can click Create to open the Create Subscription set notebook now, or you can create a subscription set later and associate it with a subscription later. See Enabling groups to access their data and files for more information on creating a subscription set.
An upload subscription is a type of JDBC subscription that allows you to insert rows directly into a table on a source database. The source table can reside on any database that supports JDBC. Upload subscriptions can improve Sync Server's throughput, simplify administration, and increase system reliability.
Upload subscriptions can be used in scenarios where the client devices are used only for collecting data only and when getting timely updates of tables on the client device is not a primary concern. Such scenarios include:
There are few restrictions on the source database except that it must support JDBC and SQL INSERT statements. Because there is no replication for an upload subscription, the burden on the Sync Server is alleviated.
In an upload subscription, when you synchronize with the Sync Server, the DB2 Everyplace database engine on the handheld device communicates directly with the source database to insert the rows that have been added to the DB2 Everyplace database. The flow of the data is one-way; the tables on the device are not refreshed. No mirror database is involved in this process.
If a primary key is used, multiple inserts that cause a primary
conflict are rejected. The rejections are logged in both the client and
the Mobile Devices Administration Center (MDAC) on the Sync Server.
Other operations, like DELETE and UPDATE, are either ignored by the source
database or rejected. Table 7 lists client operations and results.
Table 7. Client's possible operations and their consequences
Operation | Results |
---|---|
Client's INSERT operations without conflicts in the primary key | Inserted into the source database |
Client's INSERT operations with conflicts in the primary key | Rejected with error messages logged in the client and the MDAC |
Client's UPDATE operations | Rejected with error messages logged in the client and the MDAC |
Client's DELETE operations | Ignored silently |
First-time synchronization | Tables created in the client with no rows |
In an upload subscription, the Sync Server never updates the related tables in the device's DB2 Everyplace database.
Use the Create Upload Subscription notebook to create an upload table subscription. See Creating synchronization objects for information on how to open the notebook. Each table subscription that you create can reference one or more tables.
To create an upload subscription
These steps are explained in more detail in this section.
After authenticating a user, the Sync Server determines what group the user belongs to, then queries the administration control database to determine what subscription is involved in the request. For this reason, the Sync Server must be able to uniquely identify each subscription by name.
To identify an upload subscription
Encryption support for Windows CE and Win32 platforms is only available with the Microsoft High Encryption Pack available from Microsoft. The Microsoft High Encryption Pack must be installed to use encryption between Windows CE/Pocket PC clients or Win32 platform clients and the DB2 Everyplace Sync Server. Encryption support on Palm OS requires Palm OS 3.3 or later.
To specify the encryption level
On the Identification page, select the encryption level from the Encryption level drop-down list. The following three options are available:
You must specify only the source database for an upload subscription because no mirror database is involved.
To specify the source database driver and URL
On the Source page of the Create Upload Subscription notebook, provide the following information:
You must define at least one table for every upload subscription.
To add a table to the subscription
Click Filter to change the source filter used to limit the available tables in the table list. The Filter window opens.
The % symbol is a wildcard. Typing % in the Source schema and Source table fields displays all available tables in the table list.
After you define the subscription, you must specify what subscription sets use it. When you associate a subscription with a subscription set, you can then assign the subscription set to a group to provide members of the group access to the data and files. The data and files that the group can access are defined in the subscriptions that the subscription set references.
One subscription can be used by an unlimited number of subscription sets.
To specify the subscription sets that use this subscription
If no subscription sets appear in the Available subscription sets list, click Create to create a subscription set without closing the current Create Upload Subscription notebook. The Create Subscription Set notebook opens.
To provide users access to the files that they require, you define one or more file subscriptions. Unlike a DataPropagator subscription, which can contain more than one table, a file subscription can contain only one file. Thus, if your group of users needs access to several files, you must create several file subscriptions (then assign them to a subscription set as explained in Specifying what information the subscription set accesses, and assign the subscription set to the group as explained in Enabling the group to access data and files). A file cannot be referenced in multiple subscriptions.
The file to which you subscribe the group can be any file stored at the source server. You can use file subscriptions as a convenient way to distribute and update data and application files to the users. For example, it could be an application file that you want to install on the mobile devices, or a resource file required for a Palm OS application to function, or it could be a flat file containing the minutes from a morning meeting.
To create a file subscription:
These steps are explained further in this section.
After authenticating a user, the Sync Server determines the group that the user belongs to, then queries the administration control database to determine what subscription is involved in the request. For this reason, the Sync Server must be able to uniquely identify each file subscription by name.
To identify a file subscription, provide the following information on the Identification page of the Create File Subscription notebook:
Provide a descriptive, unique name for the subscription from 1 to 18 characters long. Names are case-sensitive.
Type up to 128 characters of text that describes this subscription.
Encryption support for Windows CE and Win32 platforms is only available with the Microsoft High Encryption Pack available from Microsoft. The Microsoft High Encryption Pack must be installed to use encryption between Windows CE/Pocket PC clients or Win32 platform clients and the DB2 Everyplace Sync Server. Encryption support on Palm OS requires Palm OS 3.3 or later.
To specify the encryption level
On the Identification page, select the encryption level using the Encryption level field. The following three options are available:
A source file is a file residing on a source system that is replicated to a target device.
A target file is a file on a target system receiving the contents of a source file during synchronization.
The source file must be available for selection from the mid-tier system where you invoke the Mobile Devices Administration Center. Thus, before you define the subscription, either connect to the source system where the file is stored or copy the file from the source system to the mid-tier system. If your synchronization configuration has only two tiers, the file is probably already on the system where you invoke the Mobile Devices Administration Center.
Specify the name of the source file in the Source filename field on the Identification page of the Create File Subscription notebook.
After you create the file subscription, a copy of the file that you specify here is stored to ensure integrity of the subscription in case anything happens to the file. If you update the file, you must flag the source file to be replicated again to each of the subscribed users. See Flagging a subscription that references a changed file for more information.
Because Palm OS mobile devices store the file name within the file itself, the Target filename field is ignored.
After you define the subscription, you must specify the subscription sets that make use of it. When you associate a subscription with a subscription set, you can then assign the subscription set to a group to provide its members with access to the data and files defined in the subscriptions that the subscription set references.
One subscription can be used by an unlimited number of subscription sets.
To specify the subscription sets that use this subscription:
If no subscription sets are displayed in the Available subscription sets list, you will need to create a subscription set. You can click Create to open the Create Subscription set notebook now, or you can create a subscription set later and associate it with a subscription later. See Enabling groups to access their data and files for more information on creating a subscription set.
You can also associate subscriptions with a subscription set using the Subscription set notebook. For more information, see Specifying what information the subscription set accesses.
When you make changes to a file referenced in a subscription, you need to flag that the source file has changed so that the Sync Server replicates the file to the subscribed users on the next synchronization. It is a convenient way to update or upgrade applications and data files on the mobile devices.
To flag that the source file has changed:
Use the Create Custom Subscription notebook to create a custom subscription. A Custom subscription can be used to customize the default adapters or use a 3rd party adapter.
To create a custom subscription
These steps are explained further in this section.
After authenticating a user, the Sync Server determines what group the user belongs to, then queries the administration control database to determine what subscription is involved in the request. For this reason, the Sync Server must be able to uniquely identify each subscription by name.
To identify a custom subscription
On the Identification page, fill in these fields:
Encryption is not supported with custom subscriptions. Select None in the Encryption field.
To launch the customizer
On the Identification page, Click the
push button to launch the custom Java class file defined in the Customizer
class name field of the custom adapter used by the subscription. The
Customizer is only available if the adapter requires it. Otherwise,
additional parameters for the custom subscription are entered in the
Other field.
After you define the subscription, you must specify what subscription sets use it. When you associate a subscription with a subscription set, you can then assign the subscription set to a group to provide members of the group access to the data and files defined in the subscriptions the subscription set references.
One subscription can be used by an unlimited number of subscription sets.
To specify the subscription sets that use this subscription
If no subscription sets appear in the Available subscription sets list, click Create to create a subscription set without closing the current Custom Subscription notebook. The Create Subscription Set notebook opens.
Use the Create Custom Adapter notebook to create a custom adapter. DB2 Everyplace Sync Server includes four default adapters. The default adapters are:
DSYDPROPR DataPropagator adapter for relational data DSYJDBC JDBC adapter for relational data DSYFILE File adapter for copying files Agent Adapter Remote query and stored procedure adapter for running stored procedures
Custom adapters allow you to expand the capabilities of DB2 Everyplace Sync Server.
To create a custom adapter
These steps are explained further in this section.
To identify a custom adapter
On the Identification page, fill in these fields:
To specify the Customizer class name and the signature
On the Identification page, fill in these fields:
Signature is used to identify a class of adapters. This prevents a relational data subscription being used with a file adapter. For example, if we had many instances of a WIDGET adapter (all using the same signature WidgetSig) and each instance of the WIDGET adapter had a different function, any existing custom subscription that used this WIDGET adapter could use any custom WIDGET adapter of the same signature (WidgetSig).
To specify the communication attributes
On the Identification page, fill in these fields:
XXX.XXX.XXX.XXX:PPPP
where XXX.XXX.XXX.XXX is the IP address and PPPP is the port number.
To specify the file attributes
On the Identification page, fill in these fields:
The replication-on-demand feature enables you to request replication at any time. It is an alternative to setting replication to automatically run at regular intervals. You can enable replication on demand when you create a new subscription, or when you edit an existing subscription. If you reconfigure an existing subscription, you must restart the Sync Server servlet to make the changes effective.
To enable replication on demand:
When the Sync Server servlet starts, the initial replication takes place as usual. No subsequent replications will be performed automatically. Subsequent replications can be requested by using the dsyreplicate command. To request a replication:
dsyreplicate m_vnurse
Notes: