Setting Up the Connection Profile

The Connection Profile stores information detailing where and how the local database is stored, including location and page size. The connection profile also contains UltraLiteJ runtime tuning values.

Set up the connection profile before the first database access, and check if the database exists by calling the databaseExists method in the generated package database class. Any settings you establish after the connection has already been established will not go into effect.

The generated database class automatically contains all the default settings for the connection profile. You may add other settings if necessary. For example, you can set the database to be stored in an SD card or set the encryption key of the database.

Use the com.sybase.persistence.ConnectionProfile class to set up the locally generated database. Retrieve the connection profile object using the Sybase Unwired Platform database's getConnectionProfile method.

// Initialize the device database connection profile (if needed)
ConnectionProfile connProfile = SUP101DB.getConnectionProfile();

// Store the database in an SD card
connProfile.setProperty("databaseFile", android.os.Environment.getExternalStorageDirectory().getPath() + "/SUP1011_0.ulj");

// encrypt the database
connProfile.setEncryptionKey("your encryption key"); //Encryption key can be of arbitary length, but generally the longer, the better.

// use 100K for cache size
connProfile.setCacheSize(102400);

You can also automatically generate a encryption key and store it inside a data vault.

Related reference
ConnectionProfile