![]() | ![]() |
Home |
|
|
Ultralite Developer's Guide |
|
| Chapter 1: About UltraLite |
Chapter 1
This chapter introduces you to UltraLite. It describes the purpose and defining characteristics of UltraLite.
UltraLite is a deployment technology for Adaptive Server Anywhere aimed at mobile devices and embedded devices. Intended platforms include cell phones, pagers, and personal organizers. The purpose of UltraLite is to provide the functionality and reliability of a SQL database running on these devices and the ability to synchronize data with your central database management system, while maintaining an extremely small footprint.
UltraLite allows applications on these devices to use full-featured SQL to accomplish data storage, retrieval, and manipulation. UltraLite supports referential integrity, transaction processing, and multi-table joins of all varieties. In fact, UltraLite supports most of the same data types, runtime functions, and SQL data manipulation features as Sybase Adaptive Server Anywhere.
UltraLite provides an ultra-small footprint by generating a custom database engine for your application. This custom engine includes only the features required by your application. Each UltraLite application contains its own database. This database is modeled after a reference Adaptive Server Anywhere database. An UltraLite application is written in C/C++ with embedded SQL.
The UltraLite development tools pre-process the embedded SQL, analyze the reference database, and generate C/C++ source code that implements the SQL operations in your application. When this generated code is compiled and linked with the UltraLite runtime, the result is a custom database engine for your application that can be as small as 50 kb. The code footprint for an UltraLite database engine depends on the number of SQL statements in the application and the SQL features used.
UltraLite target devices have no hard disk and tend to have relatively slow processors. The UltraLite runtime is optimized for in-memory databases, employing algorithms and data structures that provide high performance and low memory use.
UltraLite includes MobiLink synchronization technology, which allows UltraLite databases running on mobile or embedded devices to synchronize with industry-standard database management systems. MobiLink synchronization works with any ODBC-compliant data source. For example, UltraLite databases can synchronize with Sybase Adaptive Server Anywhere, Sybase Adaptive Server Enterprise, Oracle, and Microsoft SQL Server.
This version of UltraLite allows development of applications in the following environments:
MetroWerks CodeWarrior 5.0 development tools on Windows NT targeting the Palm Computing Platform: that is, any Palm Computing Platform device or emulator running operating system versions 2.0.x, or 3.0.x on a Dragonball processor. The PalmPilot Professional, Palm III, and Palm V organizers are suitable platforms.
Microsoft Visual C++ 6.0 development tools on Windows NT targeting the Windows CE 2.11 operating system running on handheld and palm-sized PCs with a MIPS, SH3, or SH4 processor, or running in the emulator.
The UltraLite tools also allow you to develop applications that run on Windows NT, so you can test the database logic in your application without downloading the UltraLite application to the target device.
SQL database products typically use a client/server architecture. The database is normally stored in one or more files in the file system or directly on a storage device. The database server receives and processes SQL requests from client applications, maintaining the database according to the requests. The server protects you from failures by guaranteeing that complete transactions are recovered in case of a failure and incomplete transactions are rolled back.
UltraLite has the same client/server architecture as other SQL database systems. However, the UltraLite database engine is not a separate process. The database engine is linked together with the application to form a single executable. The UltraLite runtime support is accessed from a DLL or from a statically linked library.
The UltraLite development process generates C/C++ source code that is compiled along with your application source code. When you link your application, you link all of the compiled C/C++ together with the UltraLite runtime library or imports library. The result is a single executable file containing application logic and database logic required by the application.

When first executed on a new device, this executable automatically creates the UltraLite database. This database is initially empty, but you can add data, either explicitly or through synchronization with a central database.
UltraLite provides the same protection against failures as other SQL database systems. UltraLite maintains the database in persistent memory rather than in a file. UltraLite target devices have no disk drive, but instead feature memory that retains content when the device is not running.
UltraLite does not allow the schema of an UltraLite database to be modified once the application is deployed. When a newer version of the application requires more tables or more columns, the newer version of the application is deployed and the UltraLite database is repopulated through synchronization.
The SQL statements used in the application must be determined at compile time. In other words, you cannot construct a SQL statement within an UltraLite application and execute it. SQL statements in an UltraLite application incorporate host variables (C/C++ variables), so they can have different effects and results depending on the input variables.
To create your own UltraLite application, you write or create the following items.
Create a reference database. A reference database is an Adaptive Server Anywhere database that serves as a model of your UltraLite database.
Write the database portion of your application in C or C++ with embedded SQL.
Optionally, write other C or C++ source files.

You then use UltraLite development tools, together with your compiler and linker, to build the application for your intended platform.
Start the Adaptive Server Anywhere personal database server, specifying your reference database and a cache size of at least 10 Mb.
Preprocess each embedded SQL source file using the SQL preprocessor, supplied with Adaptive Server Anywhere. This step relies on your reference database and on the database server.
Run the UltraLite generator. The generator uses the analyzer to write a new C source file that implements your database logic. This step relies on your reference database and on information placed in it by the preprocessor.
Compile each C or C++ source file, including all generated files, for the platform of your choice.
Link all these object files, together with the UltraLite runtime library.
The following diagram depicts the procedure of building an UltraLite database application.

To deploy your application, simply copy the single executable file to a device of your choice.

For detailed instructions, see Developing UltraLite Applications .
Most mobile and embedded applications require data to be uploaded to a central database, downloaded from a central database, or both uploaded and downloaded. This functionality is essential to making the application function effectively within the information infrastructure of an organization. MobiLink synchronization technology, included with UltraLite, is designed to work with industry standard SQL database management systems from Sybase and other vendors.
The UltraLite runtime automatically keeps track of changes made to the UltraLite database between each synchronization with the central database. When the UltraLite database is synchronized, all changes since the previous synchronization will be uploaded.
Mobile and embedded databases contain a small fraction of the data that exists in the central database. The central database is called the consolidated database: it consolidates all the data throughout the MobiLink installation.
The tables in each UltraLite database can have a subset of the rows in the central database and a subset of the columns in the central database. For example, a customer table might contain over 100 columns and 100,000 rows in the consolidated database, but the UltraLite database may only require 4 columns and 1000 rows. MobiLink allows you to define the exact subset to be downloaded to each remote database.
MobiLink synchronization is flexible. You define the subset of data using the native SQL dialect of the central database management system. In most cases, tables in the UltraLite database will correspond to tables in the central database, but this is not required. You can populate an UltraLite table from a consolidated table with a different name, or from a join of one or more tables.
When synchronizing, it is important to only transfer data that has changed rather than a complete copy of the data. The uploaded data is automatically determined by the UltraLite runtime. The downloaded data is defined using the native SQL dialect of the central database management system. This system ensures that only data that needs to be transferred is transferred.
Mobile and embedded databases frequently share common data. They also must allow updates to the same data. When two or more remote databases update the same row, the conflict cannot be prevented. It must be detected and resolved when the changes are uploaded to the central database. UltraLite synchronization automatically detects these conflicts. The conflict resolution logic is defined in the native SQL dialect of the central DBMS.
An UltraLite application synchronizes with a central, consolidated database through the MobiLink server. This server provides an interface between the communications from the UltraLite application and the database server.

You control the synchronization process using scripts. These scripts are SQL statements or procedures written in the native language of the consolidated DBMS. For example, you can use a SELECT statement to identify the columns and tables in the consolidated database that correspond to each column of a row uploaded from a table in your UltraLite application. These scripts are stored in tables within the consolidated database. Each script controls a particular event during the synchronization process.
Synchronization can occur through a variety of channels. One option is a TCP/IP connection between the application and the MobiLink server. Other platforms require different solutions. For example, the Palm Computing Platform can use HotSync, TCP/IP, or direct serial port communication. Regardless of the channel, you control the synchronization process using the same SQL scripts defined in your consolidated database.
For a detailed introduction to MobiLink synchronization, see MobiLink Synchronization .
UltraLite was designed for development using familiar tools, skills, and components already present in your enterprise. You can thus leverage the current capabilities of your organization.
UltraLite encourages high productivity by providing robust, high-level programming solutions on an increasing variety of devices. An application can be developed and implemented using the proven and powerful methodology of full-featured SQL. You need not become familiar with device-specific aspects (such as flash memory) and the disparate operating system interfaces that provide access to them. Similarly, synchronization can be achieved without becoming an expert in the various transmission protocols. Moreover, the database and synchronization components in your application are portable.
UltraLite allows you to continue to use whatever tools you already use for productive development. It adds functionality to your development process. For example, you can develop applications using Microsoft Visual C++ and test them in the various Windows PC environments before deploying them, for final testing, on a specific device.
UltraLite cooperates with all the popular industry databases, not just those from Sybase. Built with the established technology of Sybase Adaptive Server Anywhere, it uses mature and proven database technology.
Following is a list of changes and additions to the software since version 6.0.2.
Windows CE 2.11 and Visual C++ 6.0
The development tools now use Microsoft Visual C++ 6.0 to target Windows CE version 2.11. Previous releases of Windows CE are no longer supported. You may be able to develop applications for older versions of Windows CE, but this application of the UltraLite technology is not supported. The initial release of UltraLite used Microsoft Visual C++ 5.0 to target Windows CE version 2.0.
File-based persistent stores
UltraLite applications under Windows CE and Windows NT, 95, and 98 now use a file-based persistent storage mechanism. Under Windows CE, the use of a file improves performance of the UltraLite database by improving the access times for raw data. The Windows NT, 95, and 98 version uses a read-write memory mapped file as its file caching mechanism.
New data types
Real and double data types are now fully supported by both UltraLite and MobiLink technologies.
Character-set translation
The MobiLink server now translates the character set of the remote database into Unicode and communicates with the consolidated database using the Unicode ODBC API.
For more information, see Character-set translation during MobiLink synchronization .
ODBC 3.51
The MobiLink Server now uses ODBC 3.51, in common with the rest of Adaptive Server Anywhere. Version 6.0.2 of the MobiLink server used ODBC 2.0.
User settable BAUD rate
You can now specify the baud rate for communication via serial streams with Palm devices. Previously, the only available speed was 19200 BAUD. This value remains the default.
For more information, see Adding serial synchronization to your Palm application .
Optional user column
The new_row_cursor and old_row_cursor scripts allow you to optionally include an extra column in your SELECT statement to hold the user name. If your SELECT statement contains one extra column, the first column is automatically filled with the user name.
For more information, see new_row_cursor cursor script , and old_row_cursor cursor script .
Character set translation
The MobiLink synchronization server now translates all uploaded characters to Unicode and passes them to the consolidated database using the Unicode ODBC API. Conversely, it translates all downloaded characters from Unicode to the character set of your UltraLite application. Character set translation within the consolidated database server can influence the results, but the new system allows more consistent behavior across multiple platforms.
Free technical advice
Technical advice and limited support is available for free on the newsgroup sybase.public.sqlanywhere.ultralite. The host for this newsgroup is forums.sybase.com.
MobiLink server runs as a Windows NT service
When you run the MobiLink server as a service, you can configure it to continue running when you log off the Windows NT workstation.
For more information, see Running the MobiLink server as a Windows NT service .
DB2 setup scripts provided
To make it easier to use IBM DB2 as a consolidated database, a DB2 setup script has been added to the available set scripts.
For a list of setup scripts, see Creating a consolidated database .
Development on Windows CE versions before 2.11 no longer supported
The development of UltraLite Windows CE applications is now restricted to version 2.11 of the operating system.
Debug runtime libraries no longer available
Debug versions of the runtime libraries are no longer available. Debug versions were released for version 6.0.2, but were found to be of very limited use.
Persistent storage change on Windows CE
UltraLite applications under Windows CE and Windows NT, 95, and 98 now use a file-based persistent storage mechanism. The use of a file improves performance of the UltraLite database by improving the access times for row data.
Location of synchronization scripts changed
The synchronization scripts for non-Adaptive Server Anywhere databases are now installed into the MobiLink\setup subdirectory of your Adaptive Server Anywhere installation directory.
You do not need to upgrade your existing reference or consolidated databases in order to use this version of the software.
Older versions of UltraLite applications can synchronize with the new version of the MobiLink synchronization server. However, new UltraLite applications cannot synchronize with older versions of the MobiLink synchronization server.
|
|