Environment, Connection, and Statement Attributes
Environment attributes affect the entire environment, such as whether
connection pooling is enabled. Environment attributes are set with SQLSetEnvAttr and retrieved with SQLGetEnvAttr.
Connection attributes affect each connection individually, such as how long a
driver should wait while attempting to connect to a data source before timing
out. Connection attributes are set with SQLSetConnectAttr and retrieved with SQLGetConnectAttr. For more information about connection attributes, see “Connection Attributes” in Chapter 6, “Connecting to a Data Source or Driver.”
Statement attributes affect each statement individually, such as whether a
statement should be executed asynchronously. Statement attributes are set with SQLSetStmtAttr and retrieved with SQLGetStmtAttr. A few statement attributes are read-only attributes and cannot be set. For
example, the SQL_ATTR_ROW_NUMBER statement attribute, which is used to retrieve
the number of the current row in the cursor, is read-only. For more information
about statement attributes, see “Statement Attributes” in Chapter 9, “Executing Statements.”
In addition to attributes defined by ODBC, a driver can define its own
connection and statement attributes. Driver-defined attributes must be registered with
X/Open to ensure that two driver vendors do not assign the same integer value
to different, proprietary attributes. For more information, see “Driver-Specific Data Types, Descriptor Types, Information Types, Diagnostic
Types, and Attributes” in Chapter 17, “Programming Considerations.”
For a complete list of attributes, see SQLSetEnvAttr, SQLSetConnectAttr, and SQLSetStmtAttr. Most attributes are also described in the description of the ODBC function
that they affect.