ODBC Handles
[This is preliminary documentation and subject to change.]
When an application requests it, the Driver Manager and each driver allocate memory storage for information about the ODBC environment, each connection, and each SQL statement. The handles to these storage areas are returned to the application, which then uses one or more of them in each ODBC function call.
The ODBC interface defines three types of handles:
-
The environment handle is a variable of type HENV. It identifies memory storage for global information, including the valid connection handles and the current active connection handle. An application uses a single environment handle, and it must request this handle before connecting to a data source.
-
The connection handle is a variable of type HDBC. It identifies memory storage for information about a particular connection. An application must request a connection handle before connecting to a data source. Each connection handle is associated with the environment handle. The environment handle, however, can have multiple connection handles associated with it.
-
The statement handle is a variable of type HSTMT. It identifies memory storage for information about an SQL statement. An application must request a statement handle before submitting SQL requests. Each statement handle is associated with only one connection handle. Each connection handle can, however, have multiple statement handles associated with it.
See Also
Connecting to a Data Source
Multi-threading Issues in the Adapter and Client Applications
ODBC Adapter Synchronous and Asynchronous Operation
SQL Select Handling