Oracle8i JDBC Developer's Guide and Reference Release 3 (8.1.7) Part Number A83724-01 |
Library | Service | Contents | Index

## Basic Debugging Procedures

This section describes strategies for debugging a JDBC program:

- Net8 Tracing to Trap Network Events

- Third Party Debugging Tools

For information about processing SQL exceptions, including printing stack traces to aid in debugging, see "Processing SQL Exceptions".

### Net8 Tracing to Trap Network Events

You can enable client and server Net8 trace to trap the packets sent over Net8. You can use client-side tracing only for the JDBC OCI driver; it is not supported for the JDBC Thin driver. You can find more information on tracing and reading trace files in the Net8 Administrator's Guide.

The trace facility produces a detailed sequence of statements that describe network events as they execute. "Tracing" an operation lets you obtain more information on the internal operations of the event. This information is output to a readable file that identifies the events that led to the error. Several Net8 parameters in the `SQLNET.ORA` file control the gathering of trace information. After setting the parameters in `SQLNET.ORA`, you must make a new connection for tracing to be performed.

The higher the trace level, the more detail is captured in the trace file. Because the trace file can be hard to understand, start with a trace level of 4 when enabling tracing. The first part of the trace file contains connection handshake information, so look beyond this for the SQL statements and error messages related to your JDBC program.

Note: The trace facility uses a large amount of disk space and might have significant impact upon system performance. Therefore, enable tracing only when necessary.

#### Client-Side Tracing

Set the following parameters in the `SQLNET.ORA` file on the client system.

##### TRACE_LEVEL_CLIENT

Purpose: | Turns tracing on/off to a certain specified level.
Default Value: | 0 or OFF
Available Values: | 0 or OFF - No trace output 4 or USER - User trace information 10 or ADMIN - Administration trace information 16 or SUPPORT - WorldWide Customer Support trace information
Example: | TRACE_LEVEL_CLIENT=10

##### TRACE_DIRECTORY_CLIENT

Purpose: | Specifies the destination directory of the trace file.
Default Value: | $ORACLE_HOME/network/trace
Example: | on UNIX: TRACE_DIRECTORY_CLIENT=/oracle/traces on Windows NT: TRACE_DIRECTORY_CLIENT=C:\ORACLE\TRACES

##### TRACE_FILE_CLIENT

Purpose: | Specifies the name of the client trace file.
Default Value: | SQLNET.TRC
Example: | TRACE_FILE_CLIENT=cli_Connection1.trc

Note: Ensure that the name you choose for the `TRACE_FILE_CLIENT` file is different from the name you choose for the `TRACE_FILE_SERVER` file.

##### TRACE_UNIQUE_CLIENT

Default Value: | OFF
Example: | TRACE_UNIQUE_CLIENT = ON

#### Server-Side Tracing

Set the following parameters in the `SQLNET.ORA` file on the server system. Each connection will generate a separate file with a unique file name.

##### TRACE_LEVEL_SERVER

Purpose: | Turns tracing on/off to a certain specified level.
Default Value: | 0 or OFF
Available Values: | 0 or OFF - No trace output 4 or USER - User trace information 10 or ADMIN - Administration trace information 16 or SUPPORT - WorldWide Customer Support trace information
Example: | TRACE_LEVEL_SERVER=10

##### TRACE_DIRECTORY_SERVER

Purpose: | Specifies the destination directory of the trace file.
Default Value: | $ORACLE_HOME/network/trace
Example: | TRACE_DIRECTORY_SERVER=/oracle/traces

##### TRACE_FILE_SERVER

Purpose: | Specifies the name of the server trace file.
Default Value: | SERVER.TRC
Example: | TRACE_FILE_SERVER= svr_Connection1.trc

Note: Ensure that the name you choose for the `TRACE_FILE_SERVER` file is different from the name you choose for the `TRACE_FILE_CLIENT` file.

### Third Party Debugging Tools

You can use tools such as JDBCSpy and JDBCTest from Intersolv to troubleshoot at the JDBC API level. These tools are similar to ODBCSpy and ODBCTest.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index