The ConnectOption DBParm parameter

ConnectOption includes several parameters, two of which control the operation of ODBC Driver Manager Trace for any ODBC-compatible driver you are using in PocketBuilder:

Starting ODBC Driver Manager Trace in a script

The most efficient way to specify the correct values for the ConnectOption DBParm in a script is to set the options in the Database Connection Profile dialog box, as described in “Starting ODBC Driver Manager Trace in a database profile”, and then copy them from the Preview page to the script. This example shows the settings for a data source named Employee. Note that in this example, the first statement specifies that Database Trace is also on:

SQLCA.DBMS = "TRACE ODBC"
SQLCA.AutoCommit = False
SQLCA.DBParm = "ConnectString='DSN=Employee;UID=;PWD=',
ConnectOption='SQL_OPT_TRACE,SQL_OPT_TRACE_ON;
SQL_OPT_TRACEFILE,C:\logs\odbctrc.log'"

For more information, see “Copying DBParm syntax from the Preview tab”.

As an alternative to setting the DBParm property in an 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.

Use the following PowerScript syntax to specify the ProfileString function with the DBParm property:

SQLCA.dbParm = ProfileString(file, section, variable, default_value)

For example, the following statement in a PocketBuilder script reads the DBParm values from the [Database] section of the APP.INI file:

SQLCA.dbParm =
   ProfileString("APP.INI","Database","DBParm","")

Starting ODBC Driver Manager Trace in a database profile

To start ODBC Driver Manager Trace to trace your connections in the PocketBuilder development environment, edit the database profile for the connection you want to trace, as described in the following procedure.

StepsTo start ODBC Driver Manager Trace by editing the database profile:

  1. Open the Database Profile Setup dialog box for the ODBC connection you want to trace.

  2. On the Options tab, select the Trace ODBC API Calls check box.

  3. (Optional) Specify a log file where you want PocketBuilder to write the output of ODBC Driver Manager Trace.

    You can type the path name in the Trace File box, or click Browse to browse to an existing log file.

    By default, if the Trace ODBC API Calls check box is selected and no trace file is specified, PocketBuilder sends ODBC Driver Manager Trace output to the default SQL.LOG file.

  4. Click OK.

    PocketBuilder saves your settings in the registry in the HKEY_CURRENT_USER\Software\Sybase\PocketBuilder\2.0\DatabaseProfiles\Pocket PB key.

    The following example shows the DBParm string value from a database profile entry for an ODBC data source named Employee. The settings that start ODBC Driver Manager Trace are in the ConnectOption DBParm parameter:

    ConnectString='DSN=Employee;UID=;PWD=',
    ConnectOption='SQL_OPT_TRACE,SQL_OPT_TRACE_ON;
    SQL_OPT_TRACEFILE,C:\logs\odbctrc.log'
    
  5. Right-click on the connected database and select Re-connect from the drop-down menu in the Database Profiles dialog box.

    PocketBuilder connects to the database, starts tracing the ODBC connection, and writes output to the log file you specified.