> # Troubleshooting the ODBC Client

> On Windows, Microsoft ships along with their ODBC SDK an ODBC-enabled application, named ODBC Test, that you can use to test ODBC drivers and the ODBC Driver Manager. ODBC 3.51 includes both ANSI and Unicode-enabled versions of ODBC Test.

> To use ODBC Test, you must understand the ODBC API, the C language, and SQL. For more information about ODBC Test, see the Microsoft ODBC SDK Guide.

> The example and example64 applications are small C applications provided with the ODBC Client on UNIX and Linux platforms. The programs are located in the installdir/6_00_00/example directory, where installdir is the installation directory of the ODBC Client. When you run the executable, you are prompted for the ODBC data source name, user ID, and password. Once connected, a prompt will appear. You can then execute any non-parameterized SQL statements.

> The example and example64 examples are useful for executing any type of SQL statement, testing database connections and SQL statements, and verifying your database environment.

> ### ODBC Trace

> ODBC tracing allows you to trace calls to ODBC drivers and create a log of the traces. Creating a trace log is particularly useful when you are troubleshooting an issue.

> To create a trace log:

> 1. Enable tracing (see "Enabling ODBC Tracing on the ODBC Client" for more information).
> 2. Start the ODBC application and reproduce the issue.
> 3. Stop the application and turn off tracing.
> 4. Then, open the log file in a text editor and review the output to help you debug the problem.

> For a more thorough explanation of tracing, refer to the following DataDirect Knowledgebase document:

> http://knowledgebase.datadirect.com/kbase.nsf/SupportLink+Online/2549739SL

> #### Enabling ODBC Tracing on the ODBC Client

> To specify the path and name of the trace log file, type the path and name in the Log File Path field or click Browse to select a log file. If no location is specified, the trace log resides in the working directory of the application you are using.

> The default DLL, odbctrac.dll, performs tracing. If you want to use a custom DLL instead, type the path and name of the DLL in the Custom Trace DLL field or click Browse to select a DLL.

> After making these changes on the Trace tab, click Apply for them to take effect.

> Enable tracing by clicking Start Tracing Now on the Tracing tab of the ODBC Data Source Administrator. Click Stop Tracing Now to disable tracing. Tracing continues until you disable it. Be sure to turn off tracing by clicking the Stop Tracing Now button when you are finished reproducing the issue because tracing decreases the performance of your ODBC application.

> On UNIX and Linux, you can enable tracing by modifying the [ODBC] section in the system information file (the odbc.ini file). The [ODBC] section of the system information file includes three keywords related to tracing: Trace, TraceFile, and TraceDll. For example:

>     Trace=1
>     TraceFile=odbctrace.out
>     TraceDll=ODBCHOME/lib/odbctrac.so

> In this example, tracing is enabled, trace information is logged in a file named odbctrace.out, and odbctrac.so performs the tracing.

> You enable tracing by setting the value of Trace to 1. Set the value to 0 to disable tracing. Tracing continues until you disable it. Be sure to turn off tracing when you are finished reproducing the issue because tracing decreases the performance of your ODBC application.

> To specify the path and name of the trace log file, enter it as the value for TraceFile. If no location is specified, the trace log resides in the working directory of the application you are using.

> DataDirect ships a default shared object, odbctrac.so, to perform tracing. If you want to use a custom shared object instead, enter the path and name of the shared object as the value for TraceDll.

> ### The ivtestlib Tool

> The ivtestlib tool, located in the installdir/tools directory, is provided to help diagnose configuration problems in the Linux and UNIX environments (such as environment variables not correctly set or missing database client components). It attempts to load a specified ODBC driver and prints out all available error information if the load fails.

> On HP-UX, for example, if the SequeLink ODBC driver is installed in /opt/slodbc, the command:

>     ivtestlib /opt/slodbc/lib/slslk22.sl

> attempts to load the SequeLink ODBC driver. If the driver cannot be loaded, ivtestlib returns an error message explaining why.

> NOTE: On Solaris, AIX, and Linux, the full path to the driver does not have to be specified for ivtestlib. The HP-UX version of ivtestlib however, requires the full path.

> If the load is successful, ivtestlib returns a success message along with the version string of the driver on Linux and UNIX. If the driver cannot be loaded, ivtestlib returns an error message explaining why.

> #### The ivcheckcp Utility

> The ivcheckcp utility, located in the installdir/tools, checks the codepage of your system and displays the locale, code page, iananame and IANAAppCodePage. The IANAAppCodePage number is the transliteration configuration parameter for the DataDirect Driver Manager on UNIX.

> The syntax of this command is

>     ivcheckcp <locale>

> Example 1 (on AIX)

>     $ ./ivcheckcp en_US.ISO8859-1
>                       locale         codepage         iananame IANAAppCodePage
>              en_US.ISO8859-1        ISO8859-1       ISO-8859-1 4

> Example 2 (on AIX)

>     $ ./ivcheckcp 'locale -a'
>                       locale         codepage         iananame IANAAppCodePage
>                            C        ISO8859-1       ISO-8859-1 4
>                        POSIX        ISO8859-1       ISO-8859-1 4
>                        en_US        ISO8859-1       ISO-8859-1 4
>                en_US.8859-15       ISO8859-15      ISO-8859-15 111
>              en_US.ISO8859-1        ISO8859-1       ISO-8859-1 4

> Example 3 (on z/OS)

>                       locale         codepage         iananame IANAAppCodePage
>              en_US.ISO8859-1         IBM-1047          IBM1047 2102