Stopping ODBC Driver Manager Trace in a PowerBuilder application

To stop ODBC Driver Manager Trace in a PowerBuilder application script, you must change the SQL_OPT_TRACE ConnectOption parameter to SQL_OPT_TRACE_OFF. You can do this by:

Editing the DBParm property

One way to change the ConnectOption value in a PowerBuilder script is to edit the DBParm property of the Transaction object.

StepsTo stop ODBC Driver Manager Trace by editing the DBParm property:

  1. In your application script, edit the DBParm property of the Transaction object to change the value of the SQL_OPT_TRACE ConnectOption parameter to SQL_OPT_TRACE_OFF.

For example, the following statement starts ODBC Driver Manager Trace in your application and sends the output to a file named MYTRACE.LOG. (This example assumes you are using the default Transaction object SQLCA, but you can also define your own Transaction object.)

SQLCA.DBParm="ConnectString=’DSN=Test;UID=PB;
   PWD=xyz’,ConnectOption=’SQL_OPT_TRACE,
   SQL_OPT_TRACE_ON;SQL_OPT_TRACEFILE,C:\TRC.LOG’"

Here is how the same statement should look after you edit it to stop ODBC Driver Manager Trace. (You can leave the name of the trace file specified in case you want to restart tracing later.)

SQLCA.DBParm="ConnectString=’DSN=Test;UID=PB;
   PWD=xyz’,ConnectOption=’SQL_OPT_TRACE,
   SQL_OPT_TRACE_OFF;SQL_OPT_TRACEFILE,C:\TRC.LOG’"

Reading DBParm values

As an alternative to editing the DBParm property in your PowerBuilder application script, you can use the PowerScript ProfileString function to read DBParm values from a specified section of an external text file, such as an application-specific initialization file.

This assumes that the DBParm value read from your initialization file sets the value of SQL_OPT_TRACE to SQL_OPT_TRACE_OFF, as shown in the preceding example.