A reference database is a SQL Anywhere database that serves as a template for the UltraLite database you want to create. Your UltraLite database is a subset of the columns, tables, and indexes in this reference database. You select these objects as part of a publication in the reference database.
In previous versions of UltraLite, a reference database was required by some modes of development. Now, unless you are using the SQL Anywhere database as a consolidated database to collect and manage data from multiple remote databases, there is no clear development advantage to using this method—unless you want to first model your data with an architecture tool like Sybase's PowerDesigner Physical Data Model.
You can initialize an UltraLite database with the ulinit utility for UltraLite. With this utility, you can include utility options to specify different properties for the database.
Create a new SQL Anywhere database.
You can either create a new one with the dbinit utility or use Sybase Central. You can also create a SQL Anywhere database from non-SQL Anywhere databases, by migrating data from these third-party files.
Set database properties with UltraLite usage in mind The UltraLite database is generated with the same property settings as those in the reference database. By setting these options in the reference database, you also control the behavior of your UltraLite database. These options include:
Date format
Date order
Nearest century
Precision
Scale
Time format
Timestamp format
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 any convenient tool, such as Sybase Central or 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, you can do so using multiple UltraLite specific publications to define table subsets and set synchronization priority with them. See Publications in UltraLite.
Performance tipIf your UltraLite applications frequently retrieve information in a particular order, consider adding an index to your reference database specifically for this purpose. |
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, enter the following command line at a command prompt. Specifically, 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