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

Conversion from a SQL Anywhere database to an UltraLite database

Create an UltraLite database from a SQL Anywhere reference database by running the ulinit utility with the -a option. The new database is created with the same settings as those in the reference database where possible.

The SQL Anywhere reference database acts as a database template, and uses the following settings to create an UltraLite database schema:

  • Database configuration, such as the collation sequence
  • Table definitions
  • Synchronization publications

You can include data, and choose the columns, tables, and indexes as part of a publication in the reference database.

Note To initialize an UltraLite database from an RDBMS other than SQL Anywhere, use the Create Synchronization Model Wizard in SQL Central, and connect to a consolidated database when prompted to obtain the schema information.
Conversion considerations

Prior to running the ulinit utility, consider if the following reference database tasks are required:

  • Add tables, keys, indexes, and synchronization publications as needed

    Add the tables and set primary keys as needed. You can also assign foreign key relationships that you need within your UltraLite application.

    Indexes can improve performance dramatically, particularly on slow devices. Primary key columns are automatically indexed, but other types of columns are not.

    Note If your UltraLite application frequently retrieves information in a particular order, consider adding an index to your reference database specifically for this purpose.

    Use synchronization publications to synchronize different tables at different times. You can use multiple synchronization publications to define table subsets and set the synchronization priority with them.

  • Update database options or table schema that may have undesired effects

    For example, if a column in the SQL Anywhere database includes a clause that UltraLite does not support, the default value is ignored and the UltraLite default is specified for the new database.

  • Change the collation sequence if it is not supported by UltraLite

    UltraLite uses the name of the collation sequence that is defined in the reference database. You can still choose to use UTF-8 to encode the database by setting the utf8_encoding property.

    To see a list of collations and corresponding codepages supported by UltraLite, run ulinit with the -Z option at a command prompt. If the reference database uses a collation sequence that is not supported, such as UCA for CHAR collation sequences, change the collation sequence to one that is supported by performing the following steps:

    1. Use the Unload utility to unload the SQL Anywhere reference database.

    2. Create a new SQL Anywhere database with a different collation and run the reload.sql script through Interactive SQL.

Example

The following command creates a new UltraLite database named customer.udb from an existing SQL Anywhere reference database defined in the MySADb data source. Tables in the reference database are defined in TestPublication. The created UltraLite database contains all the same database options and tables contained in TestPublication, and is encrypted with the mykey encryption key.

ulinit -a "DSN=MySADb;UID=JimmyB;PWD=secret" -n TestPublication -k mykey customer.udb

The following command creates a new UltraLite database named customer.udb from an existing SQL Anywhere database named MySource.db. The tables and indexes in the created database match those contained in the Pub1 schema publication. The Pub2 synchronization publication is created in the UltraLite database.

ulinit -a DBF=MySource.db;UID=JimmyB;PWD=secret customer.udb -n Pub1 -s Pub2