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.
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:
Create the database using the uljload utility. See UltraLite Java Edition Database Load utility (uljload).
Use the ulunload and uljload utilities to convert an UltraLite database. See UltraLite Database Unload utility (ulunload).
Deploy a Java SE application to a BlackBerry smartphone by copying the UltraLite Java database to an SD card or transferring it from MobiLink using the file transfer mechanism. See MobiLink file transfers.
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.
Discuter à propos de cette page dans DocCommentXchange.
|Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0|