Creating a DSN on Linux and UNIX for TimesTen Classic

You can create a DSN in TimesTen Classic in an odbc.ini file for Linux or UNIX platforms.

This section includes the following topics for creating a DSN for TimesTen Classic. In TimesTen Scaleout, you would create the DSN within the appropriate database definitions and connectables. See Managing a Database in the Oracle TimesTen In-Memory Database Scaleout User's Guide for details.

Note:

For examples on defining a DSN, see DSN Examples for TimesTen Classic.

Create a User or System odbc.ini File

User and system DSNs are defined in one of several odbc.ini file types.

On Linux and UNIX, user DSNs are defined in the file $HOME/.odbc.ini or in a file named by the ODBCINI environment variable. This file is referred to as the user odbc.ini file. System DSNs are defined in the system odbc.ini file, which is located in timesten_home/conf/sys.odbc.ini.

The syntax for user and system odbc.ini files are the same. The syntax is described in odbc.ini File Entry Descriptions. The system odbc.ini file is created when TimesTen is installed on the system. Users must create their own user odbc.ini file.

Perform the following to create the DSN:

  1. Specify the DSN in the odbc.ini file. The DSN appears inside square brackets at the top of the DSN definition on a line by itself. For example:
    [AdminDS]
  2. Specify the TimesTen ODBC driver.

    Note:

    JDBC users need to specify the TimesTen ODBC driver to be used by the JDBC driver, as described in Connecting Using the TimesTen JDBC Driver and Driver Manager.

    To set the TimesTen ODBC driver, specify the Driver attribute in the odbc.ini file. The following example provides the TimesTen ODBC driver that this DSN is configured to use, where /disk1/timesten is the timesten_home:

    [AdminDS]
    Driver=/disk1/timesten/lib/libtten.so

    Note:

    For a list of TimesTen ODBC drivers that you can use, see Table 1-1.

  3. Specify the database directory path and prefix in the odbc.ini file. The following example defines /disk1/databases as the database directory path and FixedDs as the prefix for the database files:
    DataStore=/disk1/databases/FixedDs

    The database directory path can use environment variables, as discussed in Using Environment Variables in Database Path Names.

  4. Choose a database character set. The following example defines the database character set in the odbc.ini file as AL32UTF8:
    DatabaseCharacterSet=AL32UTF8
  5. Set connection attributes in your odbc.ini file. Attributes that do not appear in the odbc.ini file assume their default value.

    Note:

    See Connection Attributes in Oracle TimesTen In-Memory Database Reference. For examples, see DSN Examples for TimesTen Classic.

Using Environment Variables in Database Path Names

You can use environment variables in the specification of the database path name and transaction log file path name.

For example, you can specify $HOME/AdminDS for the location of the database.

Environment variables can be expressed either as $varname or $(varname). The parentheses are optional. A backslash character (\) in the database path name quotes the next character.

Note:

Environment variable expansion uses the environment of the process connecting to the database. Different processes may have different values for the same environment variables and may therefore expand the database path name differently. Environment variables can only be used in the user odbc.ini file. They cannot be specified in the system sys.odbc.ini file.