Connection Handles
ODBC does not prevent multiple simultaneous connections, if the driver
supports them. Thus, in a particular ODBC environment, multiple connection handles
might point to a variety of drivers and data sources, the same driver and a
variety of data sources, or even multiple connections to the same driver and data
source. Some drivers limit the number of active connections they support; the
SQL_MAX_DRIVER_CONNECTIONS option in SQLGetInfo specifies how many active connections a particular driver supports.
Connection handles are used primarily when connecting to the data source (SQLConnect, SQLDriverConnect, or SQLBrowseConnect), disconnecting from the data source (SQLDisconnect), getting information about the driver and data source (SQLGetInfo), retrieving diagnostics (SQLGetDiagField and SQLGetDiagRec) and performing transactions (SQLEndTran). They are also used when setting and getting connection attributes (SQLSetConnectAttr and SQLGetConnectAttr) and when getting the native format of an SQL statement (SQLNativeSql).
Connection handles are allocated with SQLAllocHandle and freed with SQLFreeHandle.
The connection’s state
The current connection-level diagnostics
The handles of statements and descriptors currently allocated on the connection
The current settings of each connection attribute