Connecting to TimesTen with ODBC and JDBC Drivers

An application can use different interfaces and drivers to access the TimesTen database.

Figure 1-1 Application Access to TimesTen Database Diagram

Description of Figure 1-1 follows
Description of "Figure 1-1 Application Access to TimesTen Database Diagram"
  • Open source languages interact with TimesTen through the Oracle Database Programming Interface for C (ODPI-C). The languages currently supported are Python and Node.js. See Getting Started in the Oracle TimesTen In-Memory Database Open Source Languages Support Guide.

  • C applications interact with TimesTen by linking with a TimesTen direct or client/server driver, by linking with the TimesTen driver manager, by linking with a generic driver manager, or by using the OCI or Pro*C/C++ APIs that indirectly access the TimesTen ODBC driver.

  • Java applications interact with TimesTen by using the TimesTen JDBC driver.

  • C++ applications can interact with TimesTen directly through ODBC, through a TimesTen-provided set of classes called TTClasses or by using the OCI or Pro*C/C++ interfaces that indirectly access the TimesTen ODBC drivers.

  • C# applications interact with TimesTen through Oracle Data Provider for .NET support for the TimesTen database.

All of these interfaces ultimately use the TimesTen ODBC driver to access a TimesTen database. These interfaces can use the TimesTen ODBC direct driver, the TimesTen ODBC client driver, the TimesTen driver manager, or a generic ODBC driver manager. See TimesTen Connection Options in the Oracle TimesTen In-Memory Database Introduction.

The following sections describe how to define TimesTen databases:

Connecting Using TimesTen ODBC Drivers

Your application can connect to the TimesTen database using TimesTen ODBC drivers.

TimesTen includes the following TimesTen ODBC drivers:

  • TimesTen Data Manager driver: A TimesTen ODBC driver for use with direct connect applications.

  • TimesTen client driver: A TimesTen client ODBC driver for use with client/server applications.

An application that links directly with a TimesTen ODBC driver (whether it is linked with the direct driver or client driver) is limited to using only the driver with which it is linked. An application linked directly to a TimesTen ODBC driver can connect to multiple databases at the same time. The TimesTen direct and client drivers support multiple connections to multiple TimesTen databases.

Note:

This option offers less flexibility but better performance than linking with a driver manager. However, an application should use a driver manager when connecting with both direct and client-server connections. If you are going to use a driver manager, use the TimesTen driver manager over a generic ODBC driver manager to maximize performance and functionality.

TimesTen includes the following two versions of the TimesTen Data Manager driver (direct driver):

  • Production: Use the production version of the TimesTen Data Manager driver for most application development and for all deployment.

  • Debug: Use the debug version of the TimesTen Data Manager driver only if you encounter problems with TimesTen itself. This version performs additional internal error checking and is slower than the production version. On Linux and UNIX, the TimesTen debug libraries are compiled with the -g option to display additional debug information.

For TimesTen Classic support on Windows, you can install the "TimesTen Client 22.1" driver after choosing either the Typical or Custom setup.

On Linux and UNIX, depending on the options selected at install time, TimesTen may install the TimesTen client driver and both the production version and the debug version of the TimesTen Data Manager driver.

Table 1-1 lists the TimesTen ODBC drivers for Linux and UNIX platforms.

Table 1-1 ODBC Drivers Provided for Linux and UNIX Platforms

Platform Version Location and name

Linux

Solaris x86

Solaris Sparc

Production

timesten_home/install/lib/libtten.so

TimesTen Data Manager 22.1 driver.

Linux

Solaris x86

Soliaris Sparc

Debug

timesten_home/install/lib/libttenD.so

TimesTen Data Manager 22.1 Debug driver.

Linux

Solaris x86

Soliaris Sparc

Client

timesten_home/install/lib/libttclient.so

TimesTen Client 22.1 driver.

AIX

Production

timesten_home/install/lib/libtten.a

TimesTen Data Manager 22.1 driver.

AIX

Debug

timesten_home/install/lib/libttenD.a

TimesTen Data Manager 22.1 Debug driver.

AIX

Client

timesten_home/install/lib/libttclient.a

TimesTen Client 22.1 driver.

macOS

Client

timesten_home/install/lib/libttclient.dylib

TimesTen Client 22.1 driver.

Connecting Using an ODBC Driver Manager

If an application process wants to use both direct and client/server TimesTen drivers, then it should link with an ODBC driver manager.

  • The TimesTen driver manager is a transparent, low overhead option designed specifically for this use case. The TimesTen driver manager supports all TimesTen functionality. See Introduction to the TimesTen Driver Manager in the Oracle TimesTen In-Memory Database C Developer's Guide.

  • Alternatively, your application can be linked with a generic ODBC driver manager. A generic ODBC driver manager typically has a significant performance impact and inhibits the use of some TimesTen functionality (such as XLA, the Routing API, the Utility API and TimesTen ODBC extensions).

Both the TimesTen driver manager and generic ODBC driver manager dynamically load an ODBC driver at runtime.

Connecting Using the TimesTen JDBC Driver and Driver Manager

The TimesTen JDBC driver enables Java applications to issue SQL statements to TimesTen and process the results. It is the primary interface for data access in the Java programming language.

As shown in Figure 1-1, the TimesTen JDBC driver uses the ODBC driver to access TimesTen databases. For each JDBC method, the driver runs a set of ODBC functions to perform the appropriate operation. Since the JDBC driver depends on ODBC for all database operations, the first step in using JDBC is to define a TimesTen database and the ODBC driver that accesses it on behalf of JDBC.

The TimesTen JDBC API is implemented using native methods to bridge to the TimesTen native API. Java provides a driver manager that can support multiple drivers connecting to separate databases. The Java DriverManager class keeps track of all JDBC drivers that have been loaded and are available to the Java application. The application may load several drivers and access each driver independently. For example, an application can load both a TimesTen client JDBC driver and an Oracle database JDBC driver. Then, Java applications can access either the TimesTen or Oracle databases.

For a list of the Java functions supported by TimesTen, see Support for Interfaces in the java.sql package in the Oracle TimesTen In-Memory Database Java Developer's Guide.