Building Offline Mobile Applications for
Windows CE: a Tutorial
This document describes how to build a Visual Basic application using the Oracle9i Lite ADOCE
interface for Pocket PC. It enables you to implement offline mobile applications for the Pocket PC using
Oracle9i Lite. It provides you with the complete framework to build, deploy, and manage offline mobile
applications. Oracle9i Lite supports various application models for the Pocket PC by supporting industry
standard interfaces such as ODBC, JDBC, and ADOCE. Topics include:
􀁺 Section 2.1, "Overview"
􀁺 Section 2.2, "Developing the Application"
􀁺 Section 2.3, "Packaging and Publishing the Application"
􀁺 Section 2.4, "Administering the Application"
􀁺 Section 2.5, "Running the Application on Pocket PC"
2.1 Overview
This document guides you through the entire offline mobile application implementation process using a
sample Pocket PC application. The sample Pocket PC application enables you to create, deploy,
administer and use a Pocket PC Windows CE application.
The sample Pocket PC application is based on typical activities of delivery personnel in the
Transportation and Logistics industry. The day-to-day operations of such personnel involve package
pick-up and delivery. A delivery person collects the complete delivery package list and the package
delivery destination information for the day before he leaves the dispatch center on his Pocket PC. As
the truck driver also carries information related to package pick-up and delivery with him, the delivery
person can work offline and update the package pick-up and delivery status on his Pocket PC. Later, he
can synchronize his updated information with the central server running in the dispatch center over any
wireless network.
2.1.1 Before You Start
This tutorial assumes that the Mobile Server is installed on the same desktop that is used for Pocket PC
application development. Before starting the offline mobile application development process, you must
ensure that the development computer and the client device meet the requirements specified below. Application Development Computer Requirements
You must configure and install the following components on the development computer.
Table 2-1 lists the configuration and installation requirements for the mobile application development
Table 2-1 Application Development Computer Requirements Client Device Requirements
You must connect the client device to the desktop and install the Oracle9i Lite client for Pocket PC on
the device. For more information on how to install the Mobile Client on the device, see Section 2.5.1,
"Installing the Mobile Client for Pocket PC".
2.2 Developing the Application
This section enables you to develop and test the Pocket PC Transport application using the Mobile
Development Kit for Pocket PC. The Pocket PC Transport application is written in eMbedded Visual
To develop and test the Pocket PC Transport application, you must perform the following tasks:
1. Create Database Objects in Oracle Lite
2. Write the Application Code
3. Compile the Application
2.2.1 Creating Database Objects in Oracle Lite
The Pocket PC Transport application automatically creates database objects in the Oracle Server
Database. During deployment, the Mobile Server creates the Oracle9i Lite database in the client device
along with the requisite tables and data. The Pocket PC Transport Application Database Objects
The Pocket PC Transport application uses the following database objects:
1. Packages Table
Requirement Description
Windows NT/2000 User
The login user on the Windows NT/2000 development computer must have
"Administrator" privileges.
Installed Java Components Java Development Kit 1.3.1 or higher.
Installed Oracle
Oracle9i Lite Mobile Server (Oracle9i Lite CD-ROM).
Oracle9i Lite (Oracle9i Lite CD-ROM).
Installed Pocket PC
Microsoft Active Sync 3.5 or higher.
Microsoft Embedded Visual Toolkit 3.x
2. Routes Table
3. Trucks Table
Table 2-2 lists functions of packages that enable you to store all information about the package.
Table 2-2 Packages Table
Table 2-3 lists functions of routes that enable you to store all information about a route.
Table 2-3 Routes Table
Table 2-4 lists functions of trucks that enable you to store all information about the availability status
and destination information for a truck.
Table 2-4 Trucks Table
Column Description
DID Package ID
DDSC Package Description
DWT Package Weight
DSTR Destination Street
DCTY Destination City
DST Destination State
DRTNR Route Number
DRTNM Route Name
DESN Signature
DSTS Package Status
TID Truck Number
PRTY Priority
PTNO Point Number
TIND Delivery 'D', or Pick-up 'P'
Column Description
ROUTE_NO Route Number (Primary Key)
ROUTE_NM Route Name
EST_TIME Estimated Time
Column Description
TRUCK_NO Truck Number (Primary Key)
TRUCK_STATUS Status of the Truck
To Create Database Objects
1. The "master" schema is available in the Oracle Database Server. In case the "master" schema is
not available, enter the following command in the Command Prompt window:
> msql system/manager@webtogo.worldSQL> create user master identified by master
2. Enter the following commands to create database objects in the Oracle Database Server.
> cd <ORACLE_HOME>\mobile\sdk\wince\samples\tutorial\Transport> msql master/mas
2.2.2 Writing the Application Code
The Pocket PC Transport application's eMbedded VB code is readily available with the sample
application. The following section explains the code written for the Transport application and is
presented below. Creating a New Project
Using eVT, you can create a new application project. From the "File" menu, choose " New Project". In
the "New Project" dialog box, select "Windows CE for the Pocket PC project". A new project is created
along with the default form. Users can drag and drop controls, and write code in the events of controls or
form. For more information, see eMbedded Visual Basic help.
Figure 2-1 displays the New Project Dialog box.
Figure 2-1 Create a New Project
ALERT_ADDRESS Mobile or Pager address to send alert to (Portal User Interface)
DRIVER_ID ID of the Truck Driver
While entering the above command to create database objects, you must provide a
mandatory space between "" and "@create_all.sql". Opening an Existing Project
Using the eMbedded Visual Basic Integrated Development Environment (IDE), open the transport.ebp
project file. You can find this project file in the
<ORACLE_HOME>\mobile\sdk\wince\samples\tutorial\Transport directory. Alternatively, you can
double-click the "transport.ebp" to open the project, the associated User Interface and code in the
eMbedded VB IDE. Connecting to Oracle Lite Using ADOCE
The ActiveX Data Objects is a programming interface which enables Visual Basic Applications to
access database functionality. It is an object oriented programming interface that is based on the COM
interface standard and provides functions to access the database engine. Oracle Lite ActiveX Data
Objects is a programming interface provided by Oracle Lite to access the Oracle Lite database in the
eMbedded Visual Basic programming environment.
The Oracle Lite ActiveX Data Objects for Windows CE control contains the following three objects:
􀁺 Connection
􀁺 Recordset
􀁺 Field
Using the "CreateObject" statement, you must create a Connection object and activate a connection
based on the DSN entry. It is available in the "ODBC.txt" file under the "\ORACE" directory of the
device. If the user creates a new Recordset object and the connection is still not opened, the default
"polite" DSN is called and the Recordset is automatically connected to the default "polite.odb" database.
Using the "CreateObject" statement, you must create a new Recordset object. Execute a SQL statement
to return records from a table by opening the recordset. You can accomplish this by specifying the table
name in the "Open" statement of the recordset.
You must not create Field objects directly because they exist only in the context of an existing recordset.
The Fields collection contains a Field object for each column in the Recordset. You can refer to a
particular field by name or by index. The Fields collection supports the Count property.
The following code example shows how to use the Fields collection to get all the field names for
"MyTable" table.
Dim rs, n
Set rs = CreateObject(oladoce.recordset) "MyTable", dbconn
for n = 0 to rs.Fields.Count -1
Msgbox rs.Fields(n).Name
Next Writing Event Handler Subroutines for Controls
Figure 2-2 displays the Transport application project opened in eMbedded Visual Basic.
Figure 2-2 Transport Application project in eMbedded Visual Basic