Synchronizing the CustDB application

CustDB (customer database) is a sample database installed with SQL Anywhere. The CustDB database is a simple sales order database.

Finding and deploying the application

The installation of UltraLiteJ includes a sample BlackBerry application that relates to the CustDB database. The application is named CustDB and the source code and related files are found in the sample-dir\ultralitej\CustDB\ directory. The CustDB directory includes the project files that can be opened with the Research In Motion (RIM) JDE.

The CustDB application can be downloaded directly onto your BlackBerry (to see how it works) by directing your BlackBerry browser to this URL:

http://ultralitej.sybase.com/
Files related to CustDB application
  • CustDB.java   This file contains all the basic database access methods. These methods include creating and connecting to databases, inserting, deleting and updating orders. This file contains many of the database calls to communicate to the back-end server.

  • SchemaCreator.java   This file contains the code to create tables on the device using UltraLiteJ.

Using the CustDB application

When initially started, the CustDB program collects information to use to interact with the server where the CustDB database is hosted. You specify the Employee ID to use for queries ("50" is recommended), the host name or IP address of the server where the data is hosted, and a port number for the connection to the server.

Initial startup screen

Once these values are specified and the settings are saved (Menu » Save), the application synchronizes with the specified server. The application only downloads orders from the server that match the Employee ID corresponding to the specified employee number (50). Only orders that are still open are selected (orders can be in one of three states: Open, Approved, or Denied).

Each order is displayed on the screen with the following information: Customer Name, Ordered Product, Ordered Quantity, Price, and Discount. The screen also shows the current status of the order and any notes pertaining to that order.

Main order display screen

Once on this screen you can add notes to the order, or change the status of the order (to either Approved or Denied). You can navigate through the orders using the Next and Previous buttons.

The CustDB program also allows you to add new orders into the database. To add a new order, click Menu » New Order.

New order screen

You may enter the quantity and discount values you require.

Before exiting the application, select Synchronize from the main menu to synchronize your changes and new orders with the server.

Application menu screen