Uredi

Deli z drugimi prek


Environment, Connection, and Statement Attributes

ODBC defines a number of attributes that are associated with environments, connections, or statements.

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.

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 addition to attributes defined by ODBC, a driver can define its own connection and statement attributes. Driver-defined attributes must be registered with Open Group 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.

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.