Skip Headers

Oracle® Database Lite Oracle Lite Client Guide Release 10.3 Part Number E12548-02 |
Home | Book List | Contents | Index | Contact Us

Previous | Next
| View PDF

# 8 Oracle Database Lite Data Access APIs

To access the data within the ODB file from your application through one of the following APIs:

- For relational database development:

  - ODBC—See Section 8.1, "ODBC" for more information.

  - JDBC—See Section 8.2, "JDBC" for more information.

  - ADO.NET—See Section 8.3, "ADO.NET" for more information.

    Any interface that supports ODBC or JDBC data sources, such as ADO.Net, can also be used to access Oracle Database Lite. The interfaces can be used either independently or in combination.

- For object and relational database development:

  - Simple Object Data Access (SODA)—See Section 8.4, "SODA" for more information.

The following sections describe the different development interfaces that you can use to store and retrieve data from the file-based Oracle Lite database:

- Section 8.1, "ODBC"

- Section 8.2, "JDBC"

- Section 8.3, "ADO.NET"

- Section 8.4, "SODA"

## 8.1 ODBC

The Microsoft Open Database Connectivity (ODBC) interface is a procedural, call-level interface for accessing any SQL database, and is supported by most database vendors. It specifies a set of functions that allow applications to connect to the database, prepare and execute SQL statements at runtime, and retrieve query results.

You can call ODBC from within C or C++ applications.

Oracle Database Lite supports Level 3 compliant ODBC 2.0 and the ODBC 3.5 drivers through Oracle Database Lite ODBC drivers with some restrictions. The ODBC 2.0 driver is installed by default. The ODBC 3.5 driver should be used solely for the standalone application that uses an embedded Oracle Lite database.

To use the ODBC 3.5 driver, you need to configure the `ODBC.INI` file. On Windows, you can modify the ODBC driver either with the `odbcad32` command-line tool or by executing the ODBC Administrator GUI tool by clicking Control Panel -> Administrative Tools -> Data Sources (ODBC).

Note:

You cannot use ODBC 3.5 for any multi-user listener application.

For a full description of using the ODBC drivers on the client, see Chapter 9, "ODBC Drivers". For an example, see the Oracle Database Lite ODBC sample application, as described in Section 9.2, "Executing the ODBC Examples".

## 8.2 JDBC

The Java Database Connectivity (JDBC) interface specifies a set of Java classes that provide an ODBC-like interface to SQL databases for Java applications. JDBC, part of the JDK core, provides an object interface to relational databases. Oracle Database Lite conforms to the JDBC 1.2 API specification standard. You can use JDBC to access data from within your Java applications.

Oracle Database Lite supports JDBC through an Oracle Database Lite Type 2 and Type 4 JDBC drivers that interpret the JDBC calls and pass them to Oracle Database Lite. The Type 4 JDBC driver can only be used for the multi-user service, as described in Chapter 5, "Building a Client/Server Environment".

For your applications, you must include the correct binaries when you package the application, as described in Section 4.3, "Packaging Your Embedded Application With the Oracle Database Lite Runtime".

See Chapter 10, "JDBC Programming" for more information on using JDBC.

## 8.3 ADO.NET

The Oracle Database Lite ADO.NET Provider implements the Microsoft ADO.NET specification. Use this programming interface to access data in .NET applications. The Oracle Database Lite ADO.NET data provider supports both .NET and Compact .NET frameworks. You can access data within your database using ADO.Net from within C# applications.

The Oracle Database Lite ADO.NET provider resides in the `Oracle.DataAccess.Lite` namespace. The ADO.Net classes that enable you to connect to the Oracle Lite database, to manage transactions, create commands, manage performance and manage BLOB objects are described in Chapter 11, "Oracle Database Lite ADO.NET Provider".

## 8.4 SODA

SODA is an interface for Oracle Database Lite development using C++. It provides object-oriented data access using method calls, relational access using SQL and object-relational mapping to bridge the gap between the two.

Object functionality is approximately three times faster than ODBC for simple operations. It allows rich datatypes—such as arrays, object pointers, and standard SQL columns. A programmer can store any data structure in the database and not worry about relational design or performing joins.

A C++ developer can use the interface for executing SQL statements. The resulting code is shorter and clearer than ODBC code. SQL queries can return objects, which can be examined and modified directly through the object-oriented layer without calling any additional SQL statements.

Finally, object-relational mapping enables the application to access relational data as if it was an object hierarchy. This is essential for replicating rich data types or object pointers to the Oracle database server.

For more information, see Chapter 12, "Using Simple Object Data Access (SODA)".