Environment Variables

These sections discuss environment variables and are specific to TimesTen Classic. For specifics on environment variables in TimesTen Scaleout, see Environment Variables in the Oracle TimesTen In-Memory Database Scaleout User's Guide.

Setting Environment Variables for TimesTen

You set environment variables for a terminal window, which enables the window to run commands for a particular instance. Here is a list of situations where you should set your environment variables:

  • After you create the instance

  • Before using any TimesTen utility

  • Before executing a direct mode application on a host running an instance

  • Before executing a client server application on a host running a client

On a Linux, UNIX, or macOS host, you set the environment variables by sourcing ttenv.sh or ttenv.csh (where which you use depends on your shell). On a Windows host, you set the environment variables by running the ttenv.bat batch file. TimesTen creates the scripts after you create an instance.

In TimesTen Classic, these scripts are located in the /bin directory of the instance home.

After sourcing these scripts, the environment variables required to use an instance are set.

The environment variables include TIMESTEN_HOME, PATH, LD_LIBRARY_PATH (or equivalent) and TNS_ADMIN.

For example:

For a Bourne-type shell, such as sh, bash, zsh, or ksh:

% cd timesten_home/bin
% . ttenv.sh

For a csh or tcsh shell:

% cd timesten_home/bin
% source ttenv.csh

Once the TIMESTEN_HOME variable is set so that the instance home is known, TimesTen makes additional settings, such as the daemon port, according to the timesten_home/conf/timesten.conf instance configuration file. See Instance Configuration File (timesten.conf) for information on the instance configuration file.

Note:

The output after sourcing indicates the path and the TIMESTEN_HOME settings, but may not indicate all settings.

Alternatively, you can use ttenv in command-line mode to fork a new shell, to set the environment, and to execute the specified command. For example, to execute ttIsql to connect to database1:

% cd timesten_home/bin
% ./ttenv ttIsql database1

Environment variables are set inside your ttIsql session and the ttIsql prompt displays. When you exit ttIsql, your shell will have its original environment variable settings.

On Windows, execute the ttenv.bat batch file from a DOS window, which changes the environment for your DOS session. For example:

C:\TimesTen\tt221_64\instance\bin>ttenv

Note:

  • On Windows, the instance home, path, classpath, library path, and path are set persistently during installation if "Register environment variables" is enabled, which is the case by default. These settings are reflected in the System control panel and persist between sessions. It is not necessary to run ttenv.bat.

  • The ttenv command-line mode does not apply to Windows.

Environment Variable Descriptions

These sections provide more details on the environment variables:

TIMESTEN_HOME Environment Variable

The TIMESTEN_HOME environment variable specifies the home directory of the instance. You explicitly set this variable when sourcing either ttenv.sh or ttenv.csh (where which you use depends on your shell).

On Windows, the TIMESTEN_HOME environment variable is set persistently if you register the environment variables during installation (the default), or is set for your session if you execute ttenv.bat.

NLS_LANG Environment Variable

This environment variable is relevant for OCI, Pro*C/C++, and ODP.NET. It is ignored for ODBC and JDBC. The character set specified in the sys.odbc.ini or user odbc.ini is used by default for the connection, if not overridden by NLS_LANG. While setting the character set explicitly is recommended, the default is normally AMERICAN_AMERICA.US7ASCII. To use the environment variable to set the character set, do the following:

% setenv NLS_LANG AMERICAN_AMERICA.WE8ISO8859P1

On Windows, the NLS_LANG setting is searched for in the registry, HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\NLS_LANG, if it is not in the environment. If your program has trouble connecting to the database, confirm the NLS_LANG setting is valid and that it indicates a character set supported by TimesTen.

For more information, see Specifying a Character Set in the Oracle TimesTen In-Memory Database C Developer's Guide.

Shared Library Path Environment Variable

The shared library path environment variable is set when sourcing ttenv.sh or ttenv.csh (where which you use depends on your shell). This environment variable specifies the path for shared libraries.

The shared library path environment variable is set as follows:

  • On Linux, ttenv.sh or ttenv.csh (where which you use depends on your shell) adds $TIMESTEN_HOME/install/lib to LD_LIBRARY_PATH.

  • On UNIX, ttenv.sh or ttenv.csh (where which you use depends on your shell) adds $TIMESTEN_HOME/install/lib to LIBPATH.

  • On macOS, ttenv.sh or ttenv.csh (where which you use depends on your shell) adds $TIMESTEN_HOME/install/lib:$TIMESTEN_HOME/install/ttoracle_home/ to DYLD_LIBRARY_PATH.

  • On Windows, ttenv.sh (or ttenv.csh) adds tt221_64\lib to LIB (or the lib directory under the top level of the installation, if some other directory name was chosen).

  • On Solaris systems, timesten_home/install/lib in LD_LIBRARY_PATH or LD_LIBRARY_PATH_64, as appropriate.

PATH Environment Variable

TimesTen provides utilities for managing and debugging your applications. For these utilities to be available, the path for executables in $TIMESTEN_HOME/bin and $TIMESTEN_HOME/install/bin must be designated in the PATH setting. The path is updated to include these directories when you source ttenv.sh or ttenv.csh (where which you use depends on your shell).

In addition, to compile programs, be sure the location of the compiler for your programming language is in the PATH setting.

Temporary Directory Environment Variable

The temporary directory environment variable specifies the location of the temporary directory. TimesTen uses this directory during recovery and other operations. The ttenv.sh or the ttenv.csh script does not set this environment variable. You must explicitly set it to avoid the operating system default.

  • On a Linux, UNIX, or macOS host, TMPDIR is the environment variable.

  • On a Windows host, TMP is the environment variable.

TNS_ADMIN Environment Variable

The TNS_ADMIN environment variable specifies the full path to the directory where the tnsnames.ora file is located.

  • For TimesTen OCI, Pro*C/C++, or ODP.NET, set the TNS_ADMIN environment variable to indicate the full path to the directory where the tnsnames.ora file is located.

  • For TimesTen Cache in TimesTen Classic, set the TNS_ADMIN environment variable to indicate the full path to the directory where the tnsnames.ora file is located. This is for access to Oracle Database data.

  • On a Linux or a UNIX host, also specify the -tnsadmin option for ttInstanceCreate or for ttInstanceModify to ensure that both TimesTen and user applications read the TNS_ADMIN setting.

Java Environment Variables

For Java applications, ensure that the locations of the java and javac executables are in the PATH setting.

In addition, Java classes and class libraries are found in the class path, as specified by the CLASSPATH environment variable. Before executing a Java program that loads any of the TimesTen JDBC drivers, the CLASSPATH setting must include the class library file and path:

$TIMESTEN_HOME/install/lib/ttjdbcjdk_ver.jar

where jdk_ver indicates the JDK version. (For example, ttjdbc17.jar.)

Note:

  • This variable is set for your session by sourcing ttenv.sh or ttenv.csh (where which you use depends on your shell) or, on Windows, is set persistently during installation if environment variables are registered (default).

  • If multiple JAR files are listed in the CLASSPATH, ensure the TimesTen JAR file is listed first.

To check the JDK version:

% java -version

To use the JMS/XLA interface, these entries must also be in your CLASSPATH:

timesten_home/install/lib/timestenjmsxla.jar
timesten_home/install/3rdparty/jms1.1/lib/jms.jar
timesten_home/install/lib/orai18n.jar

For example, the CLASSPATH would look like this example (replacing timesten_home/install as appropriate):

.:timesten_home/install/lib/ttjdbc17.jar:timesten_home/install
/lib/timestenjmsxla.jar:timesten_home/install/3rdparty/jms1.1/lib
/jms.jar:timesten_home/install/lib/orai18n.jar

By default, JMS/XLA looks for a configuration file called jmsxla.xml in the current working directory. To use another name or location for the file, specify it as part of the environment variable in the InitialContext class and add the location to the CLASSPATH setting. See JMS/XLA Configuration File and Topics in Oracle TimesTen In-Memory Database Java Developer's Guide for more information.

SYSODBCINI Environment Variable

On a Linux or UNIX host, system DSNs and their connection attributes are defined in the sys.odbc.ini file. The default location, $TIMESTEN_HOME/conf is usually sufficient.

To override the name and location of this file at runtime, set the SYSODBCINI environment variable to the path name of a sys.odbc.ini file before starting the TimesTen daemon. Any user can use a system data source.

TimesTen first looks for a DSN in the user odbc.ini file. If the DSN is not found in this file, TimesTen looks in the sys.odbc.ini file.

Use of this environment variable is discouraged. For more information, see Overview of User and System DSNs in the Oracle TimesTen In-Memory Database Operations Guide.

ODBCINI Environment Variable

On a Linux or UNIX host, applications can use the odbc.ini file to define DSNs and their connection attribute settings. By default, TimesTen first looks for the user odbc.ini file in the home directory of the user running the application. To override the name and location of this file at run-time, set the ODBCINI environment variable to indicate a desired path and file name before launching the application.

If TimesTen cannot locate a user DSN file, on a Linux or UNIX host, it looks for the sys.odbc.ini file in $TIMESTEN_HOME/conf.

Use of this environment variable is discouraged. For more information, see Overview of User and System DSNs in the Oracle TimesTen In-Memory Database Operations Guide.

SYSTTCONNECTINI Environment Variable

On a Linux, UNIX, or macOS host, client applications can use the sys.ttconnect.ini file to define logical server names. For a description of logical server names, see Working with the TimesTen Client and Server in Oracle TimesTen In-Memory Database Operations Guide.

The default location, $TIMESTEN_HOME/conf/sys.ttconnect.ini, is usually sufficient. To override the name and location of this file at runtime, set the SYSTTCONNECTINI environment variable appropriately before starting the TimesTen daemon.

On a Windows host, configure logical server names using the ODBC Data Source Administrator.

Use of this environment variable is discouraged.