Oracle9i Lite Developer's Guide for Palm
Part No. A97669-01
This document provides an overview of the Oracle9i Lite Developer's Guide for Palm. Topics include:
The Oracle9i Lite Mobile Development Kit for Palm includes:
Oracle Lite database for Palm A lightweight, embedded database.
Mobile Sync A transactional synchronization engine.
Mobile SQL for Palm OS A GUI enabled SQL interface on the client device.
Using the Mobile Development Kit for Palm, you can develop applications for use on Palm OS devices which utilize your enterprise data. The data on the devices is stored in an Oracle Lite object-relational database specifically designed for each platform. Once deployed, Oracle Lite database is transparent to the end user, and requires minimal tuning or administration.
Note:This document discusses developing applications and synchronizing with databases on the Palm Computing Platform only. For Windows CE, see the Oracle9i Lite Developer's Guide for Windows CE. For Windows 98/NT/2000/XP, see the Oracle9i Lite Developer's Guide for Windows 32.
Oracle Lite database is a small footprint, Java-enabled, relational database created specifically for laptops, handheld computers, PDAs, and information appliances. The Oracle Lite database runs on Windows 98/NT/2000/XP, Windows CE/Pocket PC, Palm Computing, and EPOC. Oracle Lite database provides ODBC and OKAPI programming interfaces to build database applications from a variety of programming languages such as C/C++ or Visual Basic. These database applications are capable of being used while disconnected from the Database server.
Mobile Sync is a small footprint application that resides on the mobile device. Mobile Sync enables you to synchronize data between handheld devices, desktop and laptop computers, and Oracle databases. Mobile Sync runs on Windows 98/NT/2000/XP, Windows CE/Pocket PC, Palm Computing, and EPOC.
There are several components to which the developer should have access:
Oracle database server.
Mobile Server which is the gateway between the mobile device and the Oracle database server.
Message Generator and Processor (MGP), a background process that manages the transaction and data exchange between the Mobile Server and the Oracle database server.
Mobile Sync Client module resides on the mobile device(s) and synchronizes with the Mobile Server over any given communication mechanism.
A communication mechanism between the and Mobile Server such as HTTP or Palm HotSync.
Typically, the handheld device needs to carry only a small subset of the data contained in a central database. For example, the sales force in a particular region only needs access to the contact information for customers in that region. Mobile Server uses a publish/subscribe model for managing data and applications. In this model the publication, which you create using the Consolidator API, defines the subset of data that you make available to particular subscribers. A subscription associates a user with a publication. As the client and server exchange data through synchronization, Mobile Server detects and resolves data conflicts using rules that you define and creates snapshots of the publication item for use on the client.
Mobile SQL allows you to create, access, and manipulate Oracle Lite database on Palm Computing Platform devices. Using Mobile SQL you can:
Execute SQL statements
A sample application is included in the Mobile Development Kit. The sample is not installed automatically with the Mobile Development Kit but it can be applied using the procedure detailed in Chapter 4.
Note:Mobile Development Kit for the Palm Computing devices also supports the native Palm Computing Platform database format. This format can be used for building applications based on a variety of Palm Computing Platform development tools.
Mobile Server supports the Oracle Lite database on Palm Computing devices. Additionally, for the Palm Computing Platform, it supports:
Mobile Development Kit for Palm Computing devices supports version 3.5 to 4.0 of the Palm Operating System.
Mobile Development Kit for Palm provides the following development interfaces:
Open Database Connectivity (ODBC) is a call-level interface for accessing SQL databases. Oracle Lite database for the Palm Computing Platform supports a subset of the ODBC 3.0 interface. See Appendix C, for more information.
The Oracle Lite Object Kernel API (OKAPI) is a C/C++ language, object database interface that gives applications access to the functionality of Oracle Lite's object kernel. You can develop Oracle Lite OKAPI programs with the development tools appropriate for the target platform, such as CodeWarrior for the Palm Computing Platform. See Chapter 5, " Programming Palm Applications ", for more information. Also, see the Oracle9i Lite (C and C++) Object Kernal API Reference for complete Oracle Lite OKAPI information.
Mobile Development Kit
Integrated Development Environment (IDE) for Palm
For more information on installing and configuring the server and development environment, see Chapter 2.
Applications require data to function, which they access through the Mobile Server. An application must be directed to the proper tables on the database which is done through the use of the snapshot on the client and the publication item on the Mobile Server. The snapshot definition is the process Mobile Server uses to direct the application which tables to use.
In most situations, the tables already exist that you will create snapshots of for your application to use. The following techniques can be used to create publication items on the Mobile Server, which then automatically create snapshots on the client when you synchronize with the database. The options for creating snapshot definitions are:
Creating a Snapshot Definition Declaratively - Create publication items using the Packaging Wizard. This is the recommended method.
Creating the Snapshot Definition Programmatically - Create a publication item programmatically using the Consolidator API.
This method takes advantage of the Mobile Server Packaging Wizard. This GUI tool can be used to package applications into a .jar file. This file is the deployment descriptor for the application which contains the information necessary for Mobile Server to manage the application. This .jar file is published to the Mobile Server repository.
A secondary feature is the ability of the Packaging Wizard to generate a SQL script which can be executed to create database tables which will be used by your application. These tables are the Oracle database base tables that the Mobile Server synchronizes with.
A graphical tool has the benefit of being a safer and less error prone technique for the development of a mobile application. Before actual application programming begins, the following steps must be executed:
Verify that the base tables exist on the database, if not:
Use the Packaging Wizard to collect the snapshot definitions.
Use the Packaging Wizard to generate a .jar file and a SQL script.
Execute the SQL script on the database to create the base tables, if they do not exist there yet.
Publish the .jar file to the Mobile Server repository.
Setup the Mobile Client.
Synchronize the Mobile Client with the Mobile Server to create the client-side snapshots.
Creating the snapshot definitions using the Packaging Wizard\Mobile Server architecture allows a centralized server to be used to manage and deploy mobile applications and the snapshot definitions they require. A step-by-step approach is described in Chapter 6.
The second way to create a database and populate data is to create a snapshot definition programmatically using the, which is described in Chapter 7. The terminology is slightly different because Mobile Server interacts with both the client system and the Oracle database. Mobile Server deals with everything in terms of publications.
A publication includes data replication objects such as publication items which are equivalent to snapshot definitions. The database base tables must exist before the Consolidator API can be invoked. The following steps are required to create a distributed database schema:
Creating a Publication
Creating a Publication Item
Create User ID
Creating a Subscription
Publications are template groups containing metadata such as table subsetting definitions and indexes. You can create publications using the Consolidator API. This API contains Java functions that implement the publish/subscribe model. You can call the functions in these APIs from within Java programs as standard function calls.
A publication item is a SQL select statement that specifies which data subset of the parent database and is replicated on the client at when synchronization occurs. A publication item usually corresponds to a snapshot on the client device. You can create publication items using the Consolidator API. This API contains Java functions that implement the publish/subscribe model. You can call the functions in this API from within Java programs as standard function calls.
Each client is identified by a user ID. For development purposes, a user ID must be created using the Resource Manager API in order to assign data subscriptions to a particular user.
Subscription links a user to a publication. You can create subscriptions using the Consolidator API. This API contains Java functions that implement the publish/subscribe model. You can call the functions in this API from within Java programs as standard function calls. To create publications and subscriptions using Java, see Section 7.1.
Creating publication items programmatically requires enhanced skills in Java to use the Resource Manager and Consolidator APIs. This method is more labor intensive. Oracle always recommends using the Packaging Wizard described in Chapter 6, which requires more steps, but is more user friendly.
The third step in the development process is to replicate the data which creates an Oracle Lite database on the development system. The Mobile Development Kit for Palm Computing device runtime libraries need to be installed before replication can be executed.
Once you configure the transport between Mobile Server and the Palm OS Emulator, you must configure and install the Mobile Sync on the Palm OS Emulator. Also, you must enter and save user and connection parameters on the emulator before you can synchronize with the Mobile Server.
For instructions on installing and configuration, see Section 3.3.
Note:You should develop your application using a Palm Computing Platform emulator. Emulators are "virtual" devices which enable you to develop and test your device applications on the desktop.
The fourth step involves the first synchronization cycle where data from the Oracle database server is replicated to the Oracle Lite database residing on the development system. The Palm OS Emulator simulates a Palm Computing Device on a Windows machine which makes it more convenient to monitor and test data synchronization. A sample Oracle Lite database is created on the Windows development system when you install the sample files included with the Mobile Development Kit.
For more information on installing the sample files, see the Oracle9i Lite Installation and Configuration Guide for Windows NT/2000/XP. For instructions on configuring and installing the emulator, see Chapter 3.
The fifth step in the development process is the application development. After you synchronize to create snapshot data on the Palm OS Emulator, you develop your application on the Windows development system (PC) using some form of Palm IDE. You should test your Palm application using the Palm OS Emulator before trying to deploy and run the application on a Palm Computing device.
See Chapter 5, " Programming Palm Applications ", for information on developing your application.
The sixth step in the development process is to test the application on the actual Palm Computing handheld device. Testing a Palm application on the device requires the developer to manually perform installation and configuration task. You should use the Palm Install Tool to manually install runtime and application libraries on the Palm Computing device. However, a more convenient way to install runtime and application libraries is to install from Web-to-Go using the built in setup option. See the Oracle9i Lite Administration and Deployment Guide for more information.
After you develop and test your Palm Computing application, you need to package the application. The Packaging Wizard enables you to create a self-contained package which includes application files and the Application Deployment Descriptor. The Mobile Server administrator uses the package to publish the Palm Computing application into the Mobile Server Repository.
For instructions on using the Packaging Wizard, see Chapter 6.