MobiLink Synchronization User's Guide
The CustDB Sample Application
Setup
The following procedure creates a remote database for CustDB. The CustDB remote database must be an UltraLite database.
The application logic for the remote database is located in the Samples\UltraLite\CustDB subdirectory of your SQL Anywhere 9 installation. It includes the following files:
Embedded SQL logic The file custdb.sqc contains the SQL statements needed to query and modify information from the UltraLite database and the calls required to start synchronization with the consolidated database.
C++ API logic The file custdbapi.cpp contains the C++ API logic.
User-interface features These features are stored separately, in platform-specific subdirectories of Samples\UltraLite\CustDB.
You will complete the following steps in order to install the sample application to a remote device that is running UltraLite:
To install the sample application to a remote device
Start the consolidated database.
Start the MobiLink synchronization server.
Install the sample application to your remote device.
Start the sample application on the remote device.
Synchronize the sample application.
The following example installs the CustDB sample on a Palm device running against a DB2 consolidated database.
Ensure that the consolidated database is running:
For a DB2 database, open a DB2 Command Window and navigate to the Samples\MobiLink\CustDB subdirectory of your SQL Anywhere 9 installation. Run the following command line, where userid and password are the user ID and password for connecting to the DB2 database:
db2 connect to CustDB user userid using password
Start the MobiLink synchronization server:
For a DB2 database, run the following command at a command prompt:
dbmlsrv9 -c "DSN=CustDB" -zp
Install the sample application to your Palm device:
On your PC, start Palm Desktop.
Click Quick Install on the Palm Desktop toolbar.
Click Add. Browse to custdb.prc in the UltraLite\palm\68k subdirectory of your SQL Anywhere 9 installation.
Click Open.
HotSync your Palm device.
Start the CustDB sample application on your Palm device:
Place your Palm device in its cradle.
When you start the sample application for the first time, you are prompted to synchronize to download an initial copy of the data. This step is required only the first time you start the application. After that, the downloaded data is stored in the UltraLite database.
Launch the sample application.
From the Applications view, tap CustDB.
An initial dialog appears, prompting you for an employee ID.
Enter an employee ID.
For the purpose of this tutorial, enter a value of 50. The sample application also allows values of 51, 52, or 53, but behaves slightly differently in these cases.
For more information about the behavior of each user ID, see Users in the CustDB sample.
A message box tells you that you must synchronize before proceeding.
Synchronize your application.
Use HotSync to obtain an initial copy of the data.
Confirm that the data has been synchronized into the application.
From the Applications view, tap the CustDB application. The display shows an entry sheet for a customer, with entries.
Synchronize the remote application with the consolidated database. You will only need to complete this step when you have made changes to the database.
Ensure that the consolidated database and the MobiLink synchronization server are running.
Place the Palm device in its cradle.
Press the HotSync button to synchronize.
You may want to reset the data in the CustDB database in order to restart the sample. To revert the data in the CustDB UltraLite database to its original state, complete the following steps.
To reset the data in the sample application
Install the ULUtil on your device:
For a Palm device, start Palm Desktop on your PC.
Click Install on the Palm Desktop toolbar.
Click Add. Browse to ulutil.prc in the UltraLite\palm\68k subdirectory of your SQL Anywhere 9 installation.
Click Done.
HotSync your Palm device.
Delete the data using ULUtil:
For a Palm device, tap the ULUtil icon.
Select CustDB and tap Delete Data.
HotSync your Palm device.