Driver-Aware Connection Pooling in the ODBC Driver for SQL Server
The ODBC Driver for SQL Server supports Driver-Aware Connection Pooling. This topic describes the enhancements made to driver-aware connection pooling in the Microsoft ODBC Driver for SQL Server on Windows:
Regardless of the connection properties, connections that use SQLDriverConnect go into a separate pool from connections that use SQLConnect.
When using SQL Server Authentication and driver-aware connection pooling, the driver does not use the Windows user’s security context for the current thread to separate connections in the pool. That is, if connections are equivalent in their parameters for Windows impersonation scenarios with SQL Server Authentication, and they are using the same SQL Server Authentication credentials to connect to the backend, different Windows users can potentially use the same pool of connections. When using Windows Authentication and driver-aware connection pooling, the driver uses the current Windows user’s security context to separate connections in the pool. That is, for Windows impersonation scenarios, different Windows users do not share connections even if the connections use the same parameters.
Driver-aware connection pooling prevents a bad connection from being returned from the pool.
Driver-aware connection pooling recognizes driver-specific connection attributes. So, if a connection uses SQL_COPT_SS_APPLICATION_INTENT set to read only, that connection gets its own connection pool.
If one of the following connection-attribute IDs or connection string keywords is different between your connection string and the pooled connection string, the driver uses a pooled connection. However, performance is better if all connection attribute IDs or connection string keywords match. (In order to match a connection in the pool, the driver resets the attribute. Performance degrades because resetting the following parameters requires an extra network call.
If two or more of the following connection attributes or connection keywords differ, a pooled connection is not used.
If there is a difference in any of the following connection keywords between your connection string and a pooled connection string, a pooled connection is not used.
If there is a difference in any of the following connection attributes between your connection string and a pooled connection string, a pooled connection is not used.
The driver can reset and adjust the following connection keywords and attributes without making an extra network call. The driver resets these parameters to ensure that the connection does not contain incorrect information.
These connection keywords are not considered when the Driver Manager tries to match your connection with a connection in the pool. (Even if you change one of these parameters, an existing connection can be reused. The driver will reset the options, as needed.) This attributes can be reset in the client side without making an extra network call.
If you change one of the following connection attributes, an existing connection can be reused. The driver will reset the value, as needed. The driver can reset these attributes in the client without making an extra network call.
All statement attributes