Compiling and Linking Applications

This section discusses how to compile and link your TTClasses applications, including a section on considerations when using an ODBC driver manager on Windows.

Note:

Recompile and relink your TTClasses applications after any TimesTen version upgrade.

You can also refer to the following sections in Oracle TimesTen In-Memory Database C Developer's Guide for related information:

Compiling and Linking Applications on Linux or UNIX

This section documents the TTClasses libraries available to link your applications to, including consideration of the TimesTen driver manager (TTDM).

TTDM is a lightweight ODBC driver manager that is designed and optimized for use with the TimesTen database. An application links directly to the TTDM library, and TTDM dynamically loads the relevant ODBC driver libraries and passes ODBC calls from the application as needed. TTDM allows an application to use TimesTen direct and client/server connections at the same time. See Introduction to the TimesTen Driver Manager in Oracle TimesTen In-Memory Database C Developer's Guide.

For compiling your applications, include the TTClasses header files that are in the installation_dir/include/ttclasses directory. You can accomplish this by including TTInclude.h from that directory, using the symbolic link from timesten_home/install to installation_dir, as follows.

Use the following compile command:

-Itimesten_home/install/include

And use this line in your code:

#include <ttclasses/TTInclude.h>

TTClasses XLA programs must also include the following:

#include <ttclasses/TTXla.h>

The following table lists the TTClasses libraries available for linking your applications on Linux or UNIX platforms. As indicated, for each TTClasses library there is a corresponding TimesTen library you must also link your application to.

Usage TTClasses Library TimesTen Library

TimesTen direct connections

libttclasses.so

libtten.so

TimesTen client/server connections

libttclassesCS.so

libttenCS.so

TimesTen driver manager

libttclassesTTDM.so

libttdrvmgr.so

For example, adding the following to the link command would result in use of the client driver:

-Ltimesten_home/install/lib -lttclassesCS

The -L option tells the linker to search the TimesTen lib directory for library files. The -lttclassesCS option links in the driver.

On AIX, when linking applications with the TimesTen ODBC client driver, the C++ runtime library must be included in the link command (because the client driver is written in C++ and AIX does not link it automatically) and must follow the client driver:

-Ltimesten_home/install/lib -lttclassesCS -lC_r

You can use the Makefile in the TimesTen Classic Quick Start to guide you in creating your own Makefile. (See About TimesTen Quick Start and Sample Applications.)

Compiling and Linking Applications on Windows

For compiling your applications, include the TTClasses header files that are in the installation_dir\include\ttclasses directory.

You can accomplish this by including TTInclude.h from that directory, using the symbolic link from timesten_home/install to installation_dir, as follows.

Use the following compile command:

/Itimesten_home\install\include

And use the following line in your code:

#include <ttclasses/TTInclude.h>

TTClasses XLA programs must also include the following:

#include <ttclasses/TTXla.h>

The following table lists the TTClasses libraries available for linking your applications on Windows platforms.

Usage Library

TimesTen client/server connections

ttclasses221CS.lib

Microsoft ODBC driver manager

ttclasses221DM.lib

See the next section, Considerations when Using an ODBC Driver Manager (Windows).

Add the appropriate library, for example timesten_home\install\lib\ttclasses221.lib, to your link command.

You can use the Makefile in the Quick Start sample_code/ttclasses directory to guide you in creating your own Makefile. (See About TimesTen Quick Start and Sample Applications.)

Considerations when Using an ODBC Driver Manager (Windows)

Be aware of the following limitations in TTClasses when you use an ODBC driver manager on Windows.

  • XLA functionality is not supported.

  • REF CURSOR functionality is not supported.

In addition, the driver manager does not support the ODBC C types SQL_C_BIGINT and SQL_C_TINYINT when used with TimesTen. When using the driver manager, you cannot call methods that use either of these data types in their signatures, such as the applicable overloaded versions of any of the following TTCmd methods: getColumn(), getColumnNullable(), getNextColumn(), getNextColumnNullable(), setParam(), getParam(), and BindParameter().