1 TTClasses Development Environment

This chapter provides information to help you get started with your TTClasses development environment.

TTClasses comes compiled and preconfigured with a TimesTen installation.

The information here includes these topics:

Setting TimesTen environment variables

This section discusses how to set environment variables for TimesTen, on Linux or UNIX or on Windows.

Set environment variables on Linux or UNIX

To use TTClasses, ensure that your shell environment variables are set correctly through the appropriate ttenv script in the timesten_home/bin directory, where timesten_home is the TimesTen instance home directory. The script is ttenv.sh or ttenv.csh on Linux or UNIX platforms (which you use depends on your shell).

Instead of doing this directly, you can add a line for the appropriate script to your login initialization script (for example, .profile or .cshrc).

Environment variable settings for TimesTen are discussed in "Environment variables" in the Oracle TimesTen In-Memory Database Installation, Migration, and Upgrade Guide. Refer to that discussion for details.

Set environment variables on Windows

Before recompiling, ensure that the PATH, INCLUDE, and LIB environment variables point to the correct Visual Studio directories. Execute the applicable Visual Studio C++ batch file (for example, VCVARS32.BAT or VSVARS32.BAT) to accomplish this.

Then set environment variables for TimesTen by running the following, where timesten_home is the TimesTen instance home directory:

timesten_home\bin\ttenv.bat

Compiling and linking applications

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

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

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 Linux or UNIX platforms.

Usage Library
TimesTen direct connections libttclasses.so
TimesTen client/server connections libttclassesCS.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 "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 direct connections ttclasses181.lib
TimesTen client/server connections ttclasses181CS.lib
Microsoft ODBC driver manager ttclasses181DM.lib

See the next section, "Considerations when using an ODBC driver manager (Windows)".


Add the appropriate library, for example timesten_home\install\lib\ttclasses181.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 "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 the ODBC driver manager on Windows.

  • XLA functionality is not supported.

  • REF CURSOR functionality is not supported.

  • The driver manager does not support LOB locator APIs or LOB data types, which are not part of the ODBC standard. However, you can use the LOB simple data interface as documented in "Working with LOBs".

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().

Note:

TimesTen supplies a sample driver manager for Windows and for Linux or UNIX with the Quick Start sample applications. (See "TimesTen Quick Start and sample applications".) It supports the TimesTen direct driver and client driver and ODBC 2.5 and does not have the functionality or performance limitations described above. Applications that must concurrently use both direct connections and client/server connections to the database can use this driver manager to achieve this with very little impact on performance.

TimesTen Quick Start and sample applications

The TimesTen Classic Quick Start and TimesTen Scaleout sample applications are available from the TimesTen GitHub location. For the TimesTen Classic Quick Start, there is a complete set of tutorials, how-to instructions, and sample applications. For TimesTen Scaleout, there are ODBC and JDBC sample applications.

After you have configured your environment, you can confirm that everything is set up correctly by compiling and running the sample applications. For TimesTen Classic, applications are located under the Quick Start sample_code directory. For instructions on compiling and running them, see the instructions in the subdirectories. For TimesTen Scaleout, clone the oracle-timesten-examples GitHub repository and follow the instructions in the README files.

For TimesTen Classic, the following are included:

  • Schema and setup: The build_sampledb script (.sh on Linux or UNIX or .bat on Windows) creates a sample database and schema. Run this script before using the sample applications.

  • Environment and setup: The ttquickstartenv script (.sh or .csh on Linux or UNIX or .bat on Windows), a superset of the ttenv script typically used for TimesTen setup, sets up the environment. Run this script each time you enter a session where you want to compile or run any of the sample applications.

  • Sample applications and setup: The Quick Start provides sample applications and their source code for TTClasses.