Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » UltraLite - Java Programming » UltraLiteJ application development

 

UltraLite and UltraLite Java edition database creation and connection approaches

Java applications must connect to a database before operations can be performed on the data. This section explains how to create or connect to an UltraLite or UltraLite Java edition database with a specified password using the UltraLiteJ API.

Note

To create an UltraLite database without using the UltraLiteJ API, you can use Sybase Central or UltraLite command line utilities. See UltraLite database creation approaches.

To create an UltraLite Java edition database without using the UltraLiteJ API, you can perform one of the following tasks:

For more information about the differences between an UltraLite and an UltraLite Java edition database, see UltraLite and UltraLite Java edition databases.

A Configuration object is used to configure a database store. Several implementations of a Configuration object are provided. A unique implementation exists for every type of database store supported by the UltraLiteJ API. Each implementation provides a set of methods used to configure the database store.

The following table lists the available Configuration object implementations for the supported database stores:

Store type UltraLiteJ API support
Android file system See ConfigFileAndroid interface [Android] [UltraLiteJ].
RIM object (BlackBerry) See ConfigObjectStore interface [BlackBerry] [UltraLiteJ].
Java SE file system See ConfigFile interface [UltraLiteJ].
Non-persistent (in memory) See ConfigNonPersistent interface [BlackBerry] [UltraLiteJ].

After creating and configuring a Configuration object, you use a Connection object to create or connect to the database. Connection objects can also be used to perform the following operations:

  • Transactions   A transaction is the set of operations between commits or rollbacks. For persistent database stores, a commit makes permanent any changes since the last commit or rollback. A rollback returns the database to the state it was in when the last commit was invoked.

    Each transaction and row-level operation in UltraLite is atomic. An insert involving multiple columns either inserts data to all the columns or to none of the columns.

    Transactions must be committed to the database using the commit method of the Connection object.

  • Prepared SQL statements   Methods are provided by the PreparedStatement interface to handle SQL statements. A PreparedStatement can be created using the prepareStatement method of the Connection object.

  • Synchronizations   A set of objects governing MobiLink synchronization is accessed from the Connection object.

 See also

Creating or connecting to a database