CLI environment
attributes that you can set using the SQLSetEnvAttr() function.
ODBC does not support setting driver-specific environment
attributes that use the SQLSetEnvAttr() function.
Only CLI applications
can set the CLI-specific
environment attributes that use this function.
- SQL_ATTR_CONNECTION_POOLING
- This attribute was deprecated in DB2® UDB
for Linux, UNIX, and Windows Version
8.
This attribute is not supported when accessing
the Informix® database server.
- SQL_ATTR_CONNECTTYPE
- This attribute replaces the SQL_CONNECTTYPE attribute. A 32-bit
integer value that specifies whether this application is to operate
in a coordinated or uncoordinated distributed environment. The possible
values are:
If you change this attribute from the default, you must
set it before any connections are established on the environment handle.
Application
typically set this attribute as an environment attribute with a call
to SQLSetEnvAttr() function.
The SQLSetEnvAttr() function
is called as soon as the environment handle is allocated. However,
because ODBC applications cannot access SQLSetEnvAttr() function,
ODBC applications must set this attribute using SQLSetConnectAttr() function
after each connection handle is allocated, but before any connections
are established.
All connections on an environment handle must
have the same SQL_ATTR_CONNECTTYPE setting. An environment cannot
have both concurrent and coordinated connections. The type of the
first connection determines the type of all subsequent connections.
SQLSetEnvAttr() returns
an error if an application attempts to change the connection type
while there is an active connection.
You can also set the default
connect type by using the ConnectType CLI/ODBC configuration keyword.
The
SQL_ATTR_CONNECTTYPE attribute is an IBM® defined
extension.
- SQL_ATTR_CP_MATCH
- This attribute was deprecated in DB2 database
version 8.
This attribute is not supported
when accessing the Informix database
server.
- SQL_ATTR_DIAGLEVEL
-
- Description
- A 32-bit integer value which represents the diagnostic level.
This is equivalent to the database manager DIAGLEVELparameter.
- Values
- Valid values are: 0, 1, 2, 3, or 4. (The default value is 3.)
For details about these values, see diaglevel - Diagnostic error capture level configuration
parameter.
- Usage notes
- You must set this attribute before any connection handles are
created.
- SQL_ATTR_DIAGPATH
-
- Description
- A pointer to a null-terminated character string that contains
the name of the directory where diagnostic data is to be placed. The
SQL_ATTR_DIAGPATH is equivalent to the database manager DIAGPATH parameter.
- Values
- The default value is the db2dump directory on UNIX and Linux operating systems, and the db2 directory
on Windows operating systems.
- Usage notes
- You must set this attribute before any connection handles are
created.
- SQL_ATTR_INFO_ACCTSTR
- Description
- A pointer to a null-terminated character string that is used to
identify the client accounting string that is sent to the data server
when DB2 Connect™ or DB2 for Linux, UNIX,
and Windows is used.
- Values
- Some servers might not be able to handle the entire length of
the value and might truncate the value. DB2 for z/OS® and DB2 Universal Database™ for z/OS and OS/390® servers
support up to 200 characters. In DB2 Version
9.7 Fix Pack 6 and later fix packs, a CLI application
can set the SQL_ATTR_INFO_ACCTSTR attribute on DB2 for i V6R1
and later servers. DB2 for i servers
support a length of up to 255 characters. To ensure that the
data is converted correctly when transmitted to a host system, use
only the characters A - Z and 0 - 9 and the underscore (_) or period
(.).
The SQL_ATTR_INFO_ACCTSTR attribute is an IBM-defined extension.
- SQL_ATTR_INFO_APPLNAME
- Description
- A pointer to a null-terminated character string that is used to
identify the client application name that is sent to the data server
when DB2 Connect or DB2 for Linux, UNIX,
and Windows is used.
- Values
- Some servers might not be able to handle the entire length of
the value and might truncate the value. DB2 for z/OS and DB2
Universal Database for z/OS and OS/390 servers
support up to 32 characters. In DB2 Version
9.7 Fix Pack 6 and later fix packs, a CLI application
can set the SQL_ATTR_INFO_APPLNAME attribute on DB2 for i V6R1
and later servers. DB2 for i servers
support a length of up to 255 characters. To ensure that the
data is converted correctly when transmitted to a host system, use
only the characters A - Z and 0 - 9 and the underscore (_) or period
(.).
The SQL_ATTR_INFO_APPLNAME attribute is an IBM defined extension.
If
you change the client application name and the accounting string is
set by the WLM_SET_CLIENT_INFO procedure, the accounting string stored
on the server is updated with the value of the accounting string from
the client information.
- SQL_ATTR_INFO_USERID
- Description
- A pointer to a null-terminated character string that is used to
identify the client user ID that is sent to the data server when DB2 Connect or DB2 for Linux, UNIX, and Windows is used.
- Values
- Some servers might not be able to handle the entire length of
the value and might truncate the value. DB2 for z/OS and DB2
Universal Database for z/OS and OS/390 servers
support up to 16 characters. In DB2 Version
9.7 Fix Pack 6 and later fix packs, a CLI application
can set the SQL_ATTR_INFO_USERID attribute on DB2 for i V6R1
and later servers. DB2 for i servers
support a length of up to 255 characters.
Do not confuse the
client user ID with the authentication user ID. The client user ID
is for identification purposes only and is not used for any authorization.
To ensure that the data is converted correctly when transmitted to
a host system, use only the characters A - Z and 0 - 9 and the underscore
(_) or period (.).
The SQL_ATTR_INFO_USERID attribute is an IBM defined extension.
If you change
the client user ID and the accounting string is set by the WLM_SET_CLIENT_INFO
procedure, the accounting string stored on the server is updated with
the value of the accounting string from the client information.
- SQL_ATTR_INFO_WRKSTNNAME
- Description
- A pointer to a null-terminated character string that is used to
identify the client workstation name that is sent to the data server
when using DB2 Connect or DB2 for Linux, UNIX,
and Windows is used.
- Values
- Some servers might not be able to handle the entire length of
the value and might truncate the value. DB2 for z/OS and DB2
Universal Database for z/OS and OS/390 servers
support up to 18 characters. In DB2 Version
9.7 Fix Pack 6 and later fix packs, a CLI application
can set the SQL_ATTR_INFO_WRKSTNNAME attribute on DB2 for i V6R1
and later servers. DB2 for i servers
support a length of up to 255 characters. To ensure that the
data is converted correctly when transmitted to a host system, use
only the characters A - Z and 0 - 9 and the underscore (_) or period
(.).
The SQL_ATTR_INFO_WRKSTNNAME attribute is an IBM defined extension.
In DB2 Version 9.7 Fix pack 6 and later
fix packs, if the SQL_ATTR_INFO_WRKSTNNAME attribute
is not specified, a default value that consists of the host name is
used. The host name is obtained by calling the gethostname() function.
If the host name is not configured or an error is encountered during
the gethostname() function call, no value for the SQL_ATTR_INFO_WRKSTNNAME attribute
is sent to the server.
- SQL_ATTR_MAXCONN
- This attribute was deprecated in DB2 Version
8.
This attribute is not supported when accessing
the Informix database servers.
- SQL_ATTR_NOTIFYLEVEL
-
- Description
- A 32-bit integer value that represents the notification level.
This is equivalent to the database manager NOTIFYLEVEL parameter.
- Values
- Valid values are: 0, 1, 2, 3, or 4. (The default value is 3.)
For details about these values, see notifylevel - Notify level configuration parameter.
- Usage notes
- You must set this attribute value before any connection handles
are created.
This attribute is not supported
when accessing the Informix database
servers.
- SQL_ATTR_ODBC_VERSION
- Description
- A 32-bit integer that determines whether certain functionality
exhibits ODBC 2.x (CLI v2)
behavior or ODBC 3.0 (CLI v5)
behavior. ODBC applications must set this environment attribute before
calling any function that has an SQLHENV argument, or the call will
return SQLSTATE HY010 (Function sequence error.).
- Values
- The listed values are used to set the value of this attribute:
- SQL_OV_ODBC3: Causes the listed ODBC 3.0 (CLI v5)
behavior:
- CLI returns
and expects ODBC 3.0 (CLI v5)
codes for date, time, and timestamp.
- CLI returns
ODBC 3.0 (CLI v5)
SQLSTATE codes when SQLError(), SQLGetDiagField(),
or SQLGetDiagRec() functions
are called.
- The CatalogName argument in a call to SQLTables() function
accepts a search pattern.
- SQL_OV_ODBC2: Causes the listed ODBC 2.x (CLI v2)
behavior:
- CLI returns
and expects ODBC 2.x (CLI v2)
codes for date, time, and timestamp.
- CLI returns
ODBC 2.0 (CLI v2)
SQLSTATE codes when SQLError(), SQLGetDiagField(),
or SQLGetDiagRec() functions
are called.
- The CatalogName argument in a call to SQLTables() function
does not accept a search pattern.
- SQL_OV_ODBC3_80:
Causes the listed ODBC 3.0 (CLI v5)
behavior:
- CLI returns
and expects ODBC 3.x codes for date, time, and timestamp.
- CLI returns
ODBC 3.x SQLSTATE codes when SQLError(), SQLGetDiagField(),
or SQLGetDiagRec() functions
are called.
- The CatalogName argument in a call to SQLTables() function
accepts a search pattern.
- SQL_ATTR_OUTPUT_NTS
- Description
- A 32-bit integer value that controls the use of null-termination
in output arguments.
- Values
- The possible values are:
- SQL_TRUE: CLI uses
null termination to indicate the length of output character strings
(default).
- SQL_FALSE: CLI does
not use null termination in output character strings.
The CLI functions
that are affected by this attribute are all of the functions that
are called for the environment (and for any connections and statements
that are allocated under the environment) that have character string
parameters.
You can set this attribute only when there are
no connection handles that are allocated under this environment.
- SQL_ATTR_PROCESSCTL
- Description
- A 32-bit mask that sets process-level attributes, which affect
all environments and connections for the process. You must set this
attribute before the environment handle is allocated.
The call
to SQLSetEnvAttr() must
have the EnvironmentHandle argument set
to SQL_NULL_HANDLE. The settings remain in effect for the duration
of the process. Generally, use this attribute only for performance
sensitive applications, where large numbers of CLI function
calls are being made. Before setting any of these bits, ensure that
the application, and any other libraries that the application calls,
comply with the restrictions that are listed.
- Values
You can combine the listed values to form a bit mask:
- SQL_PROCESSCTL_NOTHREAD - This bit indicates that the application
does not use multiple threads, or if it does use multiple threads,
guarantees that all DB2 calls
are serialized by the application. If set, CLI does
not make any system calls to serialize calls to CLI,
and sets the DB2 context type
to SQL_CTX_ORIGINAL.
- SQL_PROCESSCTL_NOFORK - This bit indicates that the application
will never fork a child process. By default, CLI does
not check to see if an application forks a child process. However,
if the CheckForFork CLI/ODBC configuration keyword is set, CLI checks
the current process ID for each function call for all applications
that are connecting to the database for which the keyword is enabled.
You can set this attribute so that CLI does
not check for forked processes for that application.
The SQL_ATTR_PROCESSCTL attribute is an IBM defined extension.
- SQL_ATTR_RESET_CONNECTION
- Description
- A 32-bit unsigned integer value that specifies whether the ODBC
Driver Manager notifies the ODBC drivers that a connection has been
placed in the connection pool on Windows operating
systems. If the SQL_ATTR_ODBC_VERSION environment attribute is set
to SQL_OV_ODBC3_80, the ODBC Driver Manager sets this attribute before
placing a connection in the connection pool so that the driver can
reset the other connection attributes to their default values. This
connection attribute is available in Version 9.7 Fix Pack 5 and later
fix packs.
- Values
- The only possible value is:
- SQL_RESET_CONNECTION_YES (default): The ODBC Driver Manager notifies
the ODBC drivers that a connection has been placed in the connection
pool.
Note: You should use SQL_ATTR_RESET_CONNECTION
only for communication between the ODBC Driver Manager and an ODBC
driver. You should not set this attribute from an application because
all connection attributes will be reset to their default value. For
example, any connection attribute values that you set by using the SQLSetConnectAttr
() function will be reset to CLI default
values and your application could behave unexpectedly.
- SQL_ATTR_SYNC_POINT
- This attribute was deprecated in DB2 database
version 8.
This attribute is not supported
when accessing the Informix database
servers.
- SQL_ATTR_TRACE
- Description
- A pointer to a null-terminated character string that is used to
turn on the CLI/ODBC
trace facility.
- Values
- The string must include the CLI keywords TRACE and TRACEPATHNAME.
For example:
"TRACE=1; TRACEPATHNAME=<dir>;"
- Usage notes
This attribute is not supported when
accessing the Informix database
servers.
- SQL_ATTR_TRACENOHEADER
- Description
- A 32-bit integer value that specifies whether header information
is included in the CLI trace
file.
- Values
- The possible values are:
- 0 - Header information is included in the CLI trace
file.
- 1 - No header information is included in the CLI trace
file.
You can use the SQL_ATTR_TRACENOHEADER attribute with an SQL_NULL_HANDLE
or with a valid environment handle.
- SQL_ATTR_USE_2BYTES_OCTET_LENGTH
- This attribute is deprecated in DB2 database
version 8.
This attribute is not supported
when accessing the Informix database
servers.
- SQL_ATTR_USE_LIGHT_OUTPUT_SQLDA
- Setting this attribute is equivalent to setting the connection
attribute SQL_ATTR_DESCRIBE_OUTPUT_LEVEL to 0. SQL_ATTR_USE_LIGHT_OUTPUT_SQLDA
is deprecated and applications should now use the connection attribute
SQL_ATTR_DESCRIBE_OUTPUT_LEVEL.
- SQL_ATTR_USER_REGISTRY_NAME
- Description
- This attribute is used only when authenticating a user on a server
that is using an identity mapping service.
- Values
- The SQL_ATTR_USER_REGISTRY_NAME attribute is set to a user defined
string that names an identity mapping registry. The format of the
name varies depending on the identity mapping service. By providing
this attribute you tell the server that the user name that is provided
can be found in this registry.
After setting this attribute, the
value is used on subsequent attempts to establish a normal connection,
establish a trusted connection, or switch the user ID on a trusted
connection.
- Usage notes
This attribute is not supported when
accessing the Informix database
servers.
- SQL_CONNECTTYPE
- This Attribute is replaced with SQL_ATTR_CONNECTTYPE.
- SQL_MAXCONN
- This Attribute is replaced with SQL_ATTR_MAXCONN.
- SQL_SYNC_POINT
- This Attribute is replaced with SQL_ATTR_SYNC_POINT.
This attribute is not supported when accessing
the Informix database servers.