Create Oracle lite Database (odb) using olite Mobile Development Kit

Oracle Database Lite (olite) is small-scale database for small devices. Oracle Lite can be used in following two design patterns,

  1. You can configure olite database to Mobile client and use automatic synchronization feature of olite server to replicate data between mobile device and oracle database server.
  2. You can use an independent olite database with you mobile application.

Whatever way is used, the data in the mobile is stored in small mobile database files with ODB and OBS extension. ODB file contains data while indexes are stored in OBS file. In olite version, all objects are stored in ODB file.

If you use synchronization method using mobile client and mobile server, olite database is automatically created on mobile device. But if you are using an independent olite database, use following method to create olite database (this guide is for windows but can be used for linux as well).

First install Oracle lite Mobile Development Kit. Oracle lite Mobile Development Kit is part of installer package for oracle Database lite. Olite Mobile Development kit include all tools to create and mange file-based lite databases. To connect a file-based olite database, a DSN (data source name) is required. By default Mobile Development Kit includes a lite database and DSN, both are named as POLITE. You can use default DSN to create your database.To create your own database, enter following command at command prompt.

Createdb polite MyDb manager

CrateDB: Mobile SQl Command to Create a database

polite: Name of the DSN

MyDb: Name of the File-based olite database

manager: Password of the system user.

Create Oracle Lite Database (odb)
Create Oracle Lite Database (odb)

Databases created using default DSN are stored at <ORACLE_HOME>\Mobile\SDK\BIN\OLDB40

Since we used the default DSN to create database, we need to make the default POLITE DSN to point towards our new database. Locate file named as “ODBC.INI” at <ORACLE_HOME>\Mobile\SDK\BIN for oracle lite database For oracle lite database version, “ODBC.INI” can be located at C:\Windows directory. Replace database name with MyDB as shown below in blod Face,

Description=Oracle Lite 40 Data Source
IsolationLevel=Read Committed

Now you can connect to you database with polite DSN which now points to MyDb database using following Mobile SQL command

msql system/[email protected]:polite

msql: Mobile SQl command to connect to file-based oracle lite database

system: Default user name

manager: Password of the system user

Polite: JDBC driver

Polite: DSN

Now you can create schema in you database as shown in figure below

Connect to Oracle Lite Database
Connect to Oracle Lite Database

In above example we used default DSN to create database. If you want to use your own DSN, You first need to register you DSN in ODBC.INI file. For example, add foll0wing command to create a DSN named MyDSN

IsolationLevel=Read Committed

You can also change the location where the new database will be stored be changing the value of DataDirectory Parameter. Now you can use follwing commands to create new database with your DSN

Createdb MyDSN MyDb manager

And use following command to connect to it

msql system/[email protected]:MyDSN

1 thought on “Create Oracle lite Database (odb) using olite Mobile Development Kit”

Leave a Reply

Your email address will not be published. Required fields are marked *