Article ID: 164221
This article describes how to enable connection pooling in an ODBC application.
Microsoft ODBC version 3.0 introduced the concept of connection pooling.
Connection pooling enables an ODBC application to reuse an existing
connection from a pool, so the ODBC application does not have to go
through the complete connection process for any subsequent connection.
When an ODBC application disconnects a connection, the connection is saved
into a pool instead of actually disconnected. How long this connection remains
in the pool depends on the CPTimeout property of the ODBC driver. When the
timeout expires, the connection is closed and removed from the pool. The ODBC
application can use SQLConfigDriver to change the value of CPTimeout, and this
value applies to all the ODBC applications that are using the specified ODBC driver.
The default value for the CPTimeout is 60 seconds. Connection pooling is very useful when an ODBC application like Microsoft Internet
Information Server (for example) connects and disconnects frequently. Microsoft
Internet Information Server (IIS) version 3.0 with Active Server Pages (ASP)
takes advantage of connection pooling. You can enable connection pooling for
IIS users by changing the value of StartConnectionPool to 1. StartConnectionPool is located under:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\W3SVC\ASP\ParametersAn ODBC application can use SQLSetEnvAttr to enable connection pooling. Following is an example of how to enable connection pooling in an ODBC application:
When the ODBC application calls SQLDisconnect the first time, the connection is saved to the pool. Any subsequent SQLConnect/SQLDisconnect that matches the required condition will reuse the first connection.
Article ID: 164221 - Last Review: June 22, 2014 - Revision: 3.0