The CLI trace contains a record of all the CLI function calls that the CLI driver made.
The CLI trace is an essential tool for diagnosing problems with applications that access the CLI driver. The CLI trace provides diagnostic information when a problem is encountered in any of the following places:
CLI trace file analysis provides a number of benefits. First, subtle program logic and parameter initialization errors are often evident in the traces. Second, CLI traces might suggest ways of better tuning an application or the databases that it accesses. For example, if a CLI trace shows that a particular set of columns is queried many times, you might want to create an index corresponding to one of the columns to improve application performance. Finally, analysis of CLI trace files can help you understand how a third-party application or interface is behaving.
You can override the TRACE keyword setting in the db2cli.ini file by setting the SQL_ATTR_TRACE environment attribute with the SQLSetEnvAttr() API in the application.
When diagnosing ODBC applications, it is often easiest to determine the problem by using an ODBC trace or a CLI trace. An ODBC driver manager provides the capability to enable an ODBC trace. An ODBC driver manager is not part of a DB2® product; you must acquire an ODBC driver manager from an independent software vendor. To determine how to enable ODBC tracing, consult your ODBC driver manager documentation.
It is important to understand the difference between an ODBC driver manager trace and a CLI driver trace. An ODBC driver manager trace shows the ODBC function calls that an ODBC application makes to the ODBC driver manager. By contrast, a CLI driver trace shows the function calls that the ODBC driver manager makes to the CLI driver on behalf of the application.
The CLI traces are specific to the DB2 software and typically contain more information than a generic ODBC trace. Both types of traces list entry and exit points for all ODBC function calls from an application and include any parameters that are passed to the ODBC functions and return codes from the ODBC functions.
An ODBC driver manager might forward some function calls directly from the application to the CLI driver. However, the ODBC driver manager might also delay or avoid forwarding some function calls to the driver. The ODBC driver manager might also modify application function arguments or map application functions to other functions before forwarding the call to the CLI driver.
For you to determine what ODBC function calls are made to the CLI driver by the ODBC driver manager, you might find an ODBC driver manager trace to be a useful complement to the CLI driver trace.
For more information about the ODBC driver manager trace, see the ODBC driver manager documentation that is provided by the independent software vendor. For more information about the Microsoft ODBC 3.0 Software Development Kit and Programmer's Reference, see http://www.msdn.microsoft.com/.
The CLI driver uses many internal DB2 functions to do its work. These internal DB2 function calls are logged in the DB2 traces. The DB2 traces are meant to assist IBM Service in problem determination and resolution.
On all workstation platforms, you can use the CLI trace utility to trace the execution of CLI stored procedures.