Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » UltraLite - Database Management and Developer Guide » UltraLite overview

CustDB sample application overview

The CustDB sample is a multi-tiered database management solution that implements MobiLink synchronization with a SQL Anywhere consolidated database.

CustDB is installed with SQL Anywhere and consists of the following:

  • A consolidated SQL Anywhere database. The database is pre-populated with sales status data.

  • A remote UltraLite database. This database is initially empty.

  • An UltraLite client application.

  • MobiLink server synchronization scripts.

Note You can only run one instance of CustDB at a time. Trying to run more than one instance brings the first instance to the foreground.

CustDB allows sales personnel to track and monitor transactions and then pool information from two types of users:

  • Sales personnel that authenticate with user IDs 51, 52, and 53.

  • Mobile managers that authenticate with user ID 50.

Information gathered by these different users can be synchronized with the consolidated database.

Both the consolidated and remote databases contain a table named ULOrder. While the consolidated database holds all orders (approved and those pending approval), the UltraLite remote database only displays a subset of rows according to the user that has authenticated.

Columns in the table appear as fields in the client application. When you add an order, you must populate the Customer, Product, Quantity, Price, and Discount fields. You can also append other details such as Status or Notes. The timestamp column identifies whether the row needs to be synchronized.

The synchronization logic for CustDB is held in the consolidated database as MobiLink synchronization scripts. Synchronization logic allows you to determine how much of the consolidated database you need to download and/or upload. You can download complete tables or partial tables (with either row or column subsets) using such techniques as timestamp-based synchronization or snapshot synchronization.

You can use SQL Central to browse the synchronization scripts that are stored in the consolidated database. SQL Central is the primary tool for adding scripts to the database.

The custdb.sql file adds each synchronization script to the consolidated database by calling ml_add_connection_script or ml_add_table_script. Connection scripts control high-level events that are not associated with a particular table. Use these events to perform global tasks that are required during every synchronization. Table scripts allow actions at specific events relating to the synchronization of a specific table, such as the start or end of uploading rows, resolving conflicts, or selecting rows to download.

SQL Anywhere CustDB database

This is the consolidated database. During installation, an ODBC data source called SQL Anywhere 17 CustDB is created for this database. The database file is located at %SQLANYSAMP17%\UltraLite\CustDB\.

You can erase changes that were synchronized into the consolidated CustDB.db file, so you have a clean version to work with using this script: %SQLANYSAMP17%\UltraLite\CustDB\makedbs.cmd.

The UltraLite CustDB database

This is the remote version of the consolidated database that contains only a subset of the information, depending on which user synchronizes the database.

The file name and location can vary depending on the platform, programming language, or even device.

  • For UltraLite.NET: %SQLANYSAMP17%\UltraLite.NET\CustDB\Common\custdb.udb

  • For all other platforms and APIs: %SQLANYSAMP17%\UltraLite\CustDB\custdb.udb

RDBMS-specific build scripts

The SQL scripts rebuild a CustDB consolidated database for any one of the supported RDBMSs.

In the %SQLANYSAMP17%\MobiLink\CustDB directory, you can find the following files:

  • For SQL Anywhere: custdb.sql
  • For Adaptive Server Enterprise: custase.sql
  • For Microsoft SQL Server: custmss.sql
  • For Oracle: custora.sql
  • For IBM DB2: custdb2.sql
  • For MySQL: custmys.sql
UltraLite CustDB client applications and ReadMe files

These are the end-user applications that provide a user-friendly interface to the UltraLite remote database. There is a sample client installed for each supported platform.

Each client application also contains a ReadMe.html or ReadMe.txt file. Each file includes an outline of the steps that are required to build and run the sample.

The location of the application and its ReadMe depends on your development environment.

Synchronization logic

The UltraLite database SQL statements and synchronization calls are located in custdbcpp.cpp for the C++ API.