Introduction to UltraLiteJ development

UltraLiteJ adds basic database functionality to your Java applications and is compatible with BlackBerry smartphones. The UltraLiteJ API contains all the methods required to connect to an UltraLiteJ database, perform schema operations, and maintain data using SQL statements. Advanced operations, such as data encryption and synchronization, are also supported.

The API for each supported platform is stored in the UltraLite.jar file of your UltraLiteJ directory, which is typically located in the UltraLite\UltraLiteJ folder of your SQL Anywhere installation.

Creating a basic UltraLiteJ application

When creating a basic UltraLiteJ application, you typically complete the following tasks:

  1. Create a new Configuration object.

    A Configuration object defines where the database is located. It also sets the username and password. Variations of the Configuration object are available for different devices and for non-persistent database stores. See Configuration interface.

  2. Create a new Connection object.

    A Connection object connects to an UltraLiteJ database using the specifications defined in the Configuration object. If the database does not exist, it is created automatically. See Connection interface.

  3. Apply TableSchema, IndexSchema, ForeignKeySchema objects.

    The schema methods provided by the Connection object allow you to create tables, columns, indexes, and foreign keys. See schemaCreateBegin function.

  4. Generate PreparedStatement objects.

    A PreparedStatement object queries the database associated with the Connection object. It accepts supported SQL statements, which are passed as Strings. With a PreparedStatement object, you can update the contents of the database. See PreparedStatement interface.

  5. Generate ResultSet objects.

    ResultSet objects are created when the Connection object executes a PreparedStatement that contains a SQL SELECT statement. With a ResultSet object, you can view the table contents of the database. See ResultSet interface.

Setting up an UltraLiteJ application

When setting up an UltraLiteJ application in your preferred Java IDE, make sure that your project is correctly configured to use the UltraLite.jar resource file, which is located in your UltraLiteJ directory.

Use the following statement to import the UltraLiteJ package into your Java file:

import ianywhere.ultralitej.*;