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

SQL Anywhere 11.0.1 » UltraLiteJ » Using UltraLiteJ » Developing UltraLiteJ applications


Introduction to UltraLiteJ development

UltraLiteJ provides basic database functionality to your Java applications. It is designed to work specifically with BlackBerry smartphones but is fully compatible with J2ME and J2SE environments. 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 in your UltraLiteJ directory, which is typically located in the UltraLite\UltraLiteJ folder of your SQL Anywhere installation.

Basic steps for creating an UltraLiteJ application

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

  1. Create a new Configuration object.

    A Configuration object defines where an UltraLiteJ database is located or where it should be created. It also specifies the username and password required to connect to the database. 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 method.

  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 containing 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.*;

All coding samples and tutorials contained in this document assume that the above statement is specified and that you are familiar with developing Java applications in your preferred IDE.