Oracle Database Lite (olite) is small-scale database for small devices. Oracle Lite can be used in following two design patterns,
- 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.
- 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 10.2.0.1.0, 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.
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 10.3.0.3.0. For oracle lite database 10.2.0.1.0 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
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
Now you can create schema in you database as shown in figure below
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
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