UltraLite User's Guide
Designing UltraLite Applications
An UltraLite application uses the collating sequence of the reference database if either of the following conditions is met.
The reference database uses a single-byte character set.
The native character encoding of the target device is multi-byte, the reference database uses the same multi-byte character encoding, and the UltraLite analyzer can find a compact representation for the collation sequence used by the reference database.
An UltraLite application uses the native multi-byte character encoding of the target platform for reasons of efficiency. When the reference database uses a different character encoding, the UltraLite application uses the default collation of the target device.
For example, if you use a 932JPN reference database to build an UltraLite application for the Windows CE platform, the application will use Unicode and the default Unicode collation information. If, instead, you use a 932JPN reference database to build an application for the Japanese Palm Computing Platform, then the UltraLite application can inherit the collation information because the native character encoding is the same as that of the reference database.
If the character set is single byte, or the native character set of the target device is the same as the character set of the reference database, columns that are CHAR(n) or VARCHAR(n) compare and sort according to the collation sequence of the reference database.
When you synchronize, the MobiLink synchronization server always translates characters uploaded from your application database to Unicode and passes them to your consolidated database server using the Unicode ODBC API. The consolidated database server, or its ODBC driver, then performs any translation that may be required to convert them to the character encoding of your consolidated database. This second translation will always occur unless your consolidated database uses Unicode.
When information is downloaded, the consolidated database server converts the characters to Unicode. The MobiLink Synchronization server then automatically translates the characters, if necessary, to suit the requirements of your UltraLite application.
When both UltraLite application and consolidated database use the same character encoding, no translation is necessary. If translation is necessary, problems can arise when multiple character codes in your UltraLite application map to a single Unicode value, or vice versa. In this event, the MobiLink synchronization server translates in a consistent manner, but behavior is influenced by the translation mechanism within the consolidated database server.
At the time of printing, all single-byte Palm Computing Platform devices uses a character set based on code page 1252 (the Windows US code page). The default Adaptive Server Anywhere collation sequence (1252Latin1) is appropriate for developing applications for the Palm Computing Platform. Japanese Palm Computing Platform devices use 932JPN.
The Windows CE operating system uses Unicode. UltraLite running on Windows CE also uses Unicode to store CHAR(n) and VARCHAR(n) columns. Adaptive Server Anywhere collating sequences define behavior for 8-bit ASCII character sets.
UltraLite for Windows CE uses the Adaptive Server Anywhere collating sequence when comparing Unicode characters that have a corresponding 8-bit ASCII character in the collating sequence being used, allowing accented characters to compare equal and sort with unaccented characters. Unicode characters that have no corresponding 8-bit ASCII character use a comparison of two Unicode values.
The error-handling objects SQLException and SQLWarning provide the capability for Java applications to obtain error or warning messages. By default, these messages are supplied in English.
Localized error and warning messages may be obtained in a non-English language by setting the Java Locale to the appropriate language. For example, to obtain French messages, the following code fragment might be used:
java.util.Locale locale = new java.util.Locale( "fr", "" ); java.util.Locale.setDefault( locale );
The default Locale should be set at the start of the program. Once a message is placed in an error-handling object, the language to be used for the message is established for that execution of the program.