Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.41 KB

environment-handles.md

File metadata and controls

29 lines (22 loc) · 1.41 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords
Environment Handles
Environment Handles
David-Engel
davidengel
01/19/2017
sql
connectivity
conceptual
environment handles [ODBC]
handles [ODBC], environment

Environment Handles

An environment is a global context in which to access data; associated with an environment is any information that is global in nature, such as:

  • The environment's state

  • The current environment-level diagnostics

  • The handles of connections currently allocated on the environment

  • The current settings of each environment attribute

Within a piece of code that implements ODBC (the Driver Manager or a driver), an environment handle identifies a structure to contain this information.

Environment handles are not frequently used in ODBC applications. They are always used in calls to SQLDataSources and SQLDrivers and sometimes used in calls to SQLAllocHandle, SQLEndTran, SQLFreeHandle, SQLGetDiagField, and SQLGetDiagRec.

Each piece of code that implements ODBC (the Driver Manager or a driver) contains one or more environment handles. For example, the Driver Manager maintains a separate environment handle for each application that is connected to it. Environment handles are allocated with SQLAllocHandle and freed with SQLFreeHandle.