Set Database File Property

You can use setProperty to specify the database file name on the device, such as the directory of the running program, a specific directory path, or a secure digital (SD) card.

ConnectionProfile cp = MyDatabaseClass.getConnectionProfile();
cp.setProperty("databaseFile", "databaseFile");
cp.save();

Examples

If you specify the databaseFile name only, with no path, the databaseFile is created in the path where the program is running:
/mydb.udb
The databaseFile is created in the /Temp directory of the Windows Mobile device:
/Temp/mydb.udb
The databaseFile is created on an SD card:
/Storage Card/mydb.sqlite
Note: For the database file path and name, the forward slash (/) is required as the path delimiter, for example /smartcard/supprj.udb.

Usage

  • Be sure to call this API before the database is created:
    • Replication-based synchronization (RBS) – call this before calling LoginToSync().
    • Message-based synchronization (MBS) – call this before calling StartBackgroundSynchronization().

    Otherwise, the application would have to be restarted, and the user would need to login and resubscribe from the server each time, as though the application was a new application without any previous data.

  • If you use replication-based synchronization, the database is UltraLite; use a database file name like mydb.udb.
  • If you use message-based synchronization, the database is SQLite; use a database file name like mydb.sqlite.
  • For message-based applications, specifying a full path and file name or storage card can only be tested on a physical device, not on an emulator.
  • If the device client user changes the file name, the device user must make sure the input file name is a valid name and path on the client side.