Environment Variables
The following sections discuss environment variables:
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\tt261_64\instance\bin>ttenvNote:
-
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
ttenvcommand-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.shorttenv.csh(where which you use depends on your shell) adds$TIMESTEN_HOME/install/libtoLD_LIBRARY_PATH. -
On UNIX,
ttenv.shorttenv.csh(where which you use depends on your shell) adds$TIMESTEN_HOME/install/libtoLIBPATH. -
On macOS,
ttenv.shorttenv.csh(where which you use depends on your shell) adds$TIMESTEN_HOME/install/lib:$TIMESTEN_HOME/install/ttoracle_home/toDYLD_LIBRARY_PATH. -
On Windows,
ttenv.sh(orttenv.csh) addstt261_64\libtoLIB(or thelibdirectory under the top level of the installation, if some other directory name was chosen). -
On Solaris systems,
timesten_home/install/libinLD_LIBRARY_PATHorLD_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,
TMPDIRis the environment variable. -
On a Windows host,
TMPis 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_ADMINenvironment variable to indicate the full path to the directory where thetnsnames.orafile is located. -
For TimesTen Cache in TimesTen Classic, set the
TNS_ADMINenvironment variable to indicate the full path to the directory where thetnsnames.orafile is located. This is for access to Oracle Database data. -
On a Linux or a UNIX host, also specify the
-tnsadminoption forttInstanceCreateor forttInstanceModifyto ensure that both TimesTen and user applications read theTNS_ADMINsetting.
Java Environment Variables
For Java applications, ensure that the locations of the
java and javac
executables are in the PATH setting.
java -versionBefore running a Java program that loads any of the TimesTen JDBC drivers, configure the JDK library file and path in your Java runtime environment. In Java, class path and module path both tell the JVM and compiler where to find code. In addition, to use the JMS/XLA interface, you must update the class path for the JMS JARs. See Setting the Module Path or Class Path for Java Development in Oracle TimesTen In-Memory Database Java Developer's Guide.
Ensure you also add
$TIMESTEN_HOME/install/lib to the environment
variable LD_LIBRARY_PATH. This environment variable specifies the path for
shared libraries, including those for the JMS/XLA interface. See Shared Library Path Environment Variable.
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.