Create an UltraLite database from a SQL Anywhere reference database

A reference database is a SQL Anywhere database that serves as a template for the UltraLite database you are creating. Your UltraLite database is a subset of the columns, tables, and indexes in the reference database. You select these objects as part of a publication in the reference database.

Creating a database from a reference database may be useful if you want to first model your data with an architecture tool such as Sybase PowerDesigner.

To create a database from a reference database, use the ulinit utility.

To initialize/extract a new UltraLite database from a reference database (command prompt)
  1. Create a new SQL Anywhere database as the reference database.

    You can create a new SQL Anywhere database with the dbinit utility or Sybase Central. You can also create a SQL Anywhere database from non-SQL Anywhere databases, by migrating data from these third-party files.

    See Creating a database.

    Configure the database with UltraLite usage in mind   The UltraLite database is generated with the same settings as those in the reference database. By setting the following options in the reference database, you also control the behavior of your UltraLite database:

    • Date format
    • Date order
    • Nearest century
    • Precision
    • Scale
    • Time format
    • Timestamp format
  2. Prepare the reference database by adding objects required by the UltraLite database:

    • Tables and keys   Add the tables and remember to set primary keys as they are required by UltraLite. If you need to, you can also assign foreign key relationships that you need within your UltraLite application. You can use Sybase Central, Sybase PowerDesigner Physical Data Model, or another database design tool. See Working with UltraLite tables and columns.

    • Indexes   An index can improve performance dramatically, particularly on slow devices. Note that primary keys are automatically indexed, but other columns are not. See When to use an index.

    • Publications   If you want to synchronize different tables at different times, use publications. You can use multiple UltraLite publications to define table subsets and set synchronization priority with them. See Publications in UltraLite.

    Performance tip

    If your UltraLite applications frequently retrieve information in a particular order, consider adding an index to your reference database specifically for this purpose. See Using index scans.

  3. Run the ulinit utility, including any necessary options.

    For example, to initialize an UltraLite database called customer.udb with tables contained in two distinct publications, run the following command. Pub1 may contain a small subset of tables for priority synchronization, while Pub2 could contain the bulk of the data.

    ulinit -a DBF=MySource.db -c DBF=customer.udb -n Pub1 -n Pub2
See also