Linking Options

A TimesTen application can link directly with the TimesTen ODBC direct driver or ODBC client driver, link with a generic driver manager, or link with the TimesTen driver manager.

Considerations for Linking Without an ODBC Driver Manager

Applications to be used solely with TimesTen can link directly with either the TimesTen ODBC direct driver or ODBC client driver, without a driver manager (or link with the TimesTen driver manager).

Linking without a generic driver manager avoids performance overhead and is a simple way to access TimesTen. However, developers of applications linked without a driver manager should be aware of the following issues.

  • The application can connect only to a DSN (data source name) that uses the driver with which it is linked. It cannot connect to a database of any other vendor, nor can it connect to a TimesTen DSN of a different TimesTen driver. (A DSN is a logical name that identifies a TimesTen database and the set of connection attributes used for connecting to the database.)

  • Windows ODBC tracing is not available.

  • The ODBC cursor library is not available.

  • Applications cannot use ODBC functions that are usually implemented by a driver manager, such as SQLDataSources and SQLDrivers.

  • Applications that use SQLCancel to close a cursor instead of SQLFreeStmt(..., SQL_CLOSE) receive a return code of SQL_SUCCESS_WITH_INFO and a SQL state of 01S05. This warning is intended to be used by the driver manager to manage its internal state. Applications should treat this warning as success.

Considerations for Linking With a Generic ODBC Driver Manager

Applications that link with an ODBC driver manager can connect to any DSN that references an ODBC driver and can even connect simultaneously to multiple DSNs that use different ODBC drivers.

Note, however, that driver managers are not available by default on most non-Windows platforms. In addition, using a generic driver manager may add significant synchronization overhead to every ODBC function call and has the following limitations:

  • The TimesTen option TT_PREFETCH_COUNT cannot be used with applications that link with a driver manager. For more information on using TT_PREFETCH_COUNT, see Prefetching Multiple Rows of Data.

  • Applications cannot set or reset the TimesTen-specific TT_PREFETCH_CLOSE connection option. See Optimizing Query Performance.

  • Transaction Log API (XLA) calls cannot be used when applications are linked with a generic driver manager.

  • The ODBC C types SQL_C_BIGINT, SQL_C_TINYINT, and SQL_C_WCHAR are not supported for an application linked with a generic driver manager when used with TimesTen. You cannot call methods that have any of these types in their signatures.

Considerations for Linking With the TimesTen Driver Manager

This section discusses behaviors for a developer to consider when you link an application with the TimesTen driver manager.

Limitations for ODBC driver managers noted in the preceding section, Considerations for Linking With a Generic ODBC Driver Manager, do not apply to TTDM.

Be aware of these behaviors when you link with TTDM:

  • An ODBC 3 application is required to declare the ODBC version it is using by calling SQLSetEnvAttr to set SQL_ATTR_ODBC_VERSION to the value SQL_OV_ODBC3. TTDM detects the ODBC version (taken to be ODBC 2.5 if there is no SQL_OV_ODBC3 setting) and adapts some aspects of its behavior accordingly. It also passes the SQLSetEnvAttr call through to the underlying driver or drivers.

  • The connection type (direct or client) is determined by TTDM at connection time based on the DSN or connection string used for the connection.

  • When an application makes its first call to a function in TTDM, TTDM will attempt to dynamically load the direct driver library (libtten.so), the client library (libttclient.so), and the utility library (libttutil.so). Loading some of these libraries may fail depending on the TimesTen installation. For example, in a client-only instance there is no direct mode library or utility library. TTDM marks those features as unavailable, and if the application calls an unavailable function it will receive an error code indicating that.

  • When an application calls an ODBC function or a TimesTen API function, it initially executes a TTDM-exported version of that function. In most cases, this TTDM stub function performs some minimal validation checks then calls the actual TimesTen function from the relevant TimesTen driver, passing the same parameters. Whatever the driver function returns is passed back to the calling application.

Tip:

Be aware of the following: