ConnectOption

Description

Sets driver-specific connection options when you are accessing an ODBC data source in PowerBuilder. These options specify the following:

Certain ConnectOption parameters apply to all ODBC drivers, whereas others apply only to particular ODBC drivers.

For information on each ConnectOption parameter and whether you can use it with your ODBC driver, see the table in the Syntax section.

NoteWhen to specify ConnectOption You must specify the ConnectOption parameter before connecting to an ODBC data source. The ConnectOption settings take effect when you connect to the database.

Applies to

Syntax

ConnectOption=' SQL_DRIVER_CONNECT,value;	
	SQL_INTEGRATED_SECURITY,value;
	SQL_OPT_TRACE,value;	
	SQL_OPT_TRACEFILE,value;
	SQL_PRESERVE_CURSORS,value;
	SQL_USE_PROCEDURE_FOR_PREPARE,value '

The following table lists the applicable ODBC drivers, purpose, and values for each ConnectOption parameter.

Parameter

Description

SQL_DRIVER_CONNECT

Driver Any ODBC driver that supports the SQLDriverConnect API call.

Purpose Specifies how the ODBC driver prompts for additional connection information (such as the user ID and password) when connecting to an ODBC data source.

Values The values you can specify are:

SQL_INTEGRATED_ SECURITY

Driver Microsoft SQL Server ODBC driver (not supplied with PowerBuilder).

Purpose Specifies the type of connection to the Microsoft SQL Server database server.

Values The values you can specify are:

For more about security mechanisms in Microsoft SQL Server, see the Microsoft documentation.

SQL_OPT_TRACE

Driver Any ODBC driver.

Purpose Turns on or turns off the ODBC Driver Manager Trace in PowerBuilder to troubleshoot a connection to an ODBC data source. The ODBC Driver Manager Trace provides detailed information about the ODBC API function calls that PowerBuilder makes when connected to an ODBC data source.

Values The values you can specify are:

For instructions on using the ODBC Driver Manager Trace, see “About ODBC Driver Manager” in Connecting to Your Database.

SQL_OPT_TRACEFILE

Driver Any ODBC driver.

Purpose Specifies the name of the trace file where you want PowerBuilder to send the output of the ODBC Driver Manager Trace. PowerBuilder appends the output to the trace file you specify until you stop the trace. To display the trace file, you can use the File Editor (in PowerBuilder) or any text editor (outside PowerBuilder).

Values You can specify any filename for the trace file, following the naming conventions of your operating system. By default, if tracing is on and you have not specified a trace file, PowerBuilder sends ODBC Driver Manager Trace output to the file \SQL.LOG.

SQL_PRESERVE_ CURSORS

Driver Microsoft SQL Server ODBC driver (not supplied with PowerBuilder).

Purpose Specifies whether cursors are closed or left open on a SQLTransact call.

Values The values you can specify are:

SQL_USE_PROCEDURE_ FOR_PREPARE

Driver Microsoft SQL Server ODBC driver (not supplied with PowerBuilder).

Purpose Specifies how temporary stored procedures are treated for a SQLPrepare call.

Values The values you can specify are:

Default

ConnectOption='SQL_DRIVER_CONNECT, SQL_DRIVER_COMPLETE; SQL_INTEGRATED_SECURITY,SQL_IS_OFF; SQL_OPT_TRACE,SQL_OPT_TRACE_OFF; SQL_PRESERVE_CURSORS,SQL_PC_OFF; SQL_USE_PROCEDURE_FOR_PREPARE,SQL_UP_ON'

Usage

Microsoft Server ODBC driver The ConnectOption parameter applies only if you are accessing a SQL Server database with the Microsoft ODBC SQL Server driver.

You must obtain the Microsoft SQL Server ODBC driver from Microsoft Corporation. This driver is not supplied with PowerBuilder.

Examples

Example 1

To specify nondefault options for the ConnectOption parameter: