UltraLite User's Guide
Developing UltraLite Java Applications
Connecting to and configuring your UltraLite database
You can configure the following aspects of the UltraLite Java database:
Whether the database is transient or persistent.
If the database is persistent, you can supply a filename.
If the database is transient, you can supply a URL for an initializing database.
You can set an encryption key.
These aspects can be configured by supplying special values in the database URL, or by supplying a Properties object when creating the database. The encryption key cannot be set on the URL, but must be set in a Properties object.
For more information, see Using the UltraLite JdbcDatabase.connect method, and Using a Properties object to store connection information.
By default, UltraLite Java databases are transient: they are initialized when the database object is instantiated, and vanish when the application closes down. The next time the application starts, it must reinitialize a database.
You can make UltraLite Java databases persistent by storing them in a file. You do this by specifying the persist and persistfile elements of the JDBC URL, or by supplying persist and persistfile Properties to the database connect method.
The database for C/C++ UltraLite applications is initialized on the first synchronization call. For UltraLite Java applications that use a transient database, there is an alternative method of initializing the database. The URL for an UltraLite database that is used as the initial database is supplied in the persistfile component to the URL.
The database configuration components of the URL are as follows:
persist This can take one of the following values:
none In this case, the database is transient. It is stored in memory while the application runs, but vanishes once the application terminates.
file In this case, the database is stored as a file. The default filename is database.udb, where database is the database class name.
The default setting is none.
persistfile The meaning of this component depends on the setting for persist.
If the persist component has a value of none, the persistfile component is a URL for an UltraLite database file that is used to initialize the database.
Both the schema and the data from the URL are used to initialize the application database, but there is no further connection between the two. Any changes made by your application apply only to the transient database, not to the initializing database.
The following JDBC URL is an example:
jdbc:ultralite:transient:none:http://www.address.com/transient.udb
You can prepare the initializing database with an application that uses the persistent form of the URL to create the database, synchronize, and exit.
If the persist component has a value of file, the persistfile component is a filename for the persistent UltraLite database. The filename should include any extension (such as .udb) that you wish to use.