|
Oracle9i Lite Developer's Guide for Palm
Release 5.0.2 Part No. A97669-01 |
|
This document discusses replication using Mobile Server. Topics include:
Mobile Server allows applications and data on handheld devices to be synchronized, and shared with an Oracle database. Data on the device can be mapped directly to an Oracle database server through the Mobile Server. The Mobile Server uses a publish/subscribe model that manages the data subsetting policy for the mobile devices. Data on the device is synchronized to an Oracle database using Mobile Sync over of the following transports:
HTTP
HotSync, Network HotSync for Palm Computing devices
Mobile Server allows new and existing applications and data on handheld devices to be synchronized, and shared with an Oracle database. Data on the device can be mapped directly to an Oracle database through a Mobile Server agent. The Mobile Development Kit uses a publish/subscribe model that manages the data subsetting policy for the handheld client devices. Data on the device is mapped to the Oracle database through transport by HTTP or Active Sync.
The most common method of synchronization is a fast refresh, where changes are uploaded by the client, and changes for that client are downloaded. Meanwhile, a background process periodically collects the changes uploaded by all clients and applies them to the database tables, then composes new data, ready to be downloaded to each client during the next synchronization, based on predefined parameters referred to as subscriptions.
The other common method of synchronization is the complete refresh. During a complete refresh, all of the data for a publication is downloaded to the client. For example, during the very first synchronization session, all of the data on the client is refreshed from the Oracle database. This form of synchronization takes longer because all the tables referred to by that publication are transferred to the client device.
Data is synchronized between an Oracle Lite database on an offline client and an Oracle database instance by invoking the Mobile Sync Client module from the client device which interacts with the Mobile Server. The Mobile Server uses synchronization objects such as users, publications, publication items, and subscriptions to handle client operations during a synchronization session. This makes up the publish and subscribe model of synchronization which underlies Oracle Lite.
Publication items contain SQL queries that are defined against Oracle database tables. Publication items are snapshot definitions that can have optional subscription parameters, which determine what data is synchronized.
Publications serve as containers for publication items in the Mobile Server repository, and map to the snapshot created on a client device.
Publication items contain SQL queries that are defined against Oracle database tables. Publication items are snapshot definitions that can have optional subscription parameters, which determine what data is synchronized.
Parameters are used to define user-dependent data subsetting variables. Data subsetting allows refinement of the data requirements for a given user subsurface to a publication.
A publication is subscribed to by one or more users. Users and subscriptions are tracked by the Mobile Server.
Through established subscriptions, the Mobile Server prepares any new data for each client which is then downloaded when the client synchronizes. Only the required subset of data is downloaded to each client. If the publication has been flagged for complete refresh, all the data is downloaded.
Oracle Lite uses an asynchronous method for synchronization between Oracle Lite database clients and an Oracle database server through the Mobile Server. This means that the Mobile Sync module operates independently of the MGP; neither is dependent on the other to complete its operation.
Figure 3-1 Fast Refresh Synchronization
The default method of synchronization is the fast refresh mode which is displayed in Figure 3-1. Fast refresh is an incremental refresh where changes are uploaded and stored in inqueues during the upload phase, then the changes, which have been stored in outqueues, are downloaded and applied to the client. Meanwhile, the MGP periodically looks at the inqueues and takes anything found in an inqueue and applies it to the database during the apply phase. Changes generated by this client, other clients, and server-side applications to the Oracle database are then composed and stored in an outqueue until the next time the client synchronizes.
The upload/download phases are performed independently of any apply/compose phases. An apply phase is not dependent on an upload phase, nor is a download phase dependent on a compose phase. During any synchronization session, download occurs after upload, and compose occurs after apply.
When synchronization is initiated, the client opens a connection to the Mobile Server via the selected mode of transport, which causes the Mobile Server to open a connection to the Oracle database server. The following process is displayed in Figure 3-2.
Figure 3-2 Upload/ Download Phases
Changes to Oracle Lite database records are accumulated and flagged with codes for the type of Data Manipulation Language (DML) operation performed, Insert, Update, or Delete. The the data is encrypted, compressed, and sent to the Mobile Server to populate objects called inqueues. An inqueue is a persistent database object created to store data temporarily during synchronization.
During the same session, snapshots on the client are updated by applying data from the outqueue to the Oracle Lite database. An outqueue differs from an inqueue in that it is not a table but a datastructure containing a reference to the data contained in the Oracle database base tables. See Section 7.4.9, "Queue Interface for Customizing Replication" for information on customizing the way the inqueues and outqueues process data.
The MGP takes any contents of the inqueue and applies it to the base tables on the Oracle database. Any conflicts are detected and resolved at this time. See Section 7.5.3, "Resolving Conflicts Using the Error Queue" for more information about this topic.
Figure 3-3 Apply/Compose Phases
After the apply phase, the MGP reviews the base tables and composes and stores in the outqueues any changes to be downloaded to the client. The apply/compose phase is displayed in Figure 3-3.
|
Note: The MGP is a background process which periodically becomes active, looks at the inqueues, and applies the changes to the Oracle database base tables. Depending on how the MGP has been configured, there may be a delay in how quickly it composes and readies the outqueues to be downloaded to the client regardless of how frequently you synchronize. The changes are stored safely in the inqueues, until the MGP to processes them, after which they are downloaded to the client on the next synchronization |
During a complete refresh, all contents of the snapshot tables present on the client are refreshed from the Oracle database tables. The MGP is not involved because all the contents are refreshed, but this form of synchronization is more time and system-resource intensive.
The Mobile Development Kit for Palm has already been installed on the Windows Development system. Several shared libraries and Palm applications are available for the Palm Computing Platform:
okapi.prc - This is the core shared library that contains all OKAPI functions.
olLibC.prc - This is the Standard C Library.
odbc.prc - This is the ODBC shared library.
ocHttpTransport.prc - Standard HTTP transport driver (used by OCAPI)
The following optional items can be installed if needed.
msync.prc - This is the Mobile Sync program.
msql.prc - Allows the developer to query the Oracle Lite database for Palm using Mobile SQL.
ocCompressTransport: Compression transport driver. (used by OCAPI). This is only neccesary if you wish to implement compression.
To use Palm shared libraries and applications with the Palm OS Emulator:
Launch the Palm OS Emulator application
Drag and drop the following shared libraries and application files located in the <ORACLE_HOME>\Mobile\SDK\Palm\runtime\shlib directory over the Palm OS Emulator:
okapi.prc
olLibC.prc
odbc.prc
ocHttpTransport.prc
If you decide to install mSQL and mSync, drag and drop the following files from <ORACLE_HOME>\Mobile\SDK\Palm\runtime\bin over the Palm OS Emulator:
msync.prc
msql.prc
You should see two new icons on the Palm Desktop as displayed in Figure 3-4:
mSQL for the Mobile SQL application
mSync for the Mobile client application
Figure 3-4 Mobile SQL and Mobile Sync Icons
The remaining .prc files are shared libraries and do not appear on the Palm desktop. To check if these files has been properly installed:
Select 'Menu' from the Palm Desktop
Select 'App ->Delete' from the menu selection bar
All installed applications and shared libraries are listed. Look for OL_SYNC, mSQL, ORACLE LITE Index, and ORACLE LITE DBMS as displayed in Figure 3-5.
Tap 'Done' to exit without deleting.
Figure 3-5 Installed Files
Start the mSync client application.
Mobile client for Palm requires the parameters listed in Table 3-1 to sync:
Table 3-1 Mobile Client Parameters
| Parameter | Description |
|---|---|
| User Name | Mobile Client user name. This field is not case sensitive. |
| Password | Mobile Client password. This field is case sensitive. |
| Change | Leave this box clear. |
| Save Password | Select this check box to save the password. |
| http://<mobile server> | The Mobile Server IP address. |
| Use Proxy | Select if appropriate. |
|
Important: The Sample Orders demo is used in this chapter to demonstrate replication. This sample demo must be installed separately. See the Oracle9i Lite Installation and Configuration Guide for Windows NT/2000/XP for information on installing the Sample Orders demo application. See Chapter 4 for more information about the Sample Orders demo. |
Use the following user name and password to make use of the SAMPLE11 sample application. A separate user name and password must be provided for any custom made applications and user snapshots.
User Name = S11U1
Password = MANAGER
Tap the mSync icon to start the Mobile Client application. The "mSync" screen appears as displayed in Figure 3-6.
Figure 3-6 Oracle Mobile Sync screen
Enter the information in the necessary fields. Remember to select the Save Password check box, the password will change to read "-Assigned-" as displayed. The http:// field can contain a screen name or an IP address.
Tap the 'Apply' button.
Tap the 'Sync' button.
A progress bar appears to indicate the completion of each synchronization task: composing, sending receiving, and processing. The progress bar also displays the time each task took to complete. If synchronization executes successfully, the synchronization Success screen appears. If synchronization fails, a "sync failed" message appears. To determine the cause of a failed synchronization the server administrator can view tracing information in the Mobile Server log file.
|
![]() Copyright © 2002 Oracle Corporation All rights reserved |
|