You are currently offline, waiting for your internet to reconnect

INFO: How to Enable Connection Pooling in an OLE DB Application

This article was previously published under Q166083
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
SUMMARY
This article describes how to enable ODBC connection pooling in an OLE DBapplication.
MORE INFORMATION
An OLE DB application can enable ODBC connection pooling if the OLE DBapplication is using the OLE DB provider for ODBC. The OLE DB applicationthat uses the ODBC provider is like an ODBC application because the ODBCprovider internally calls the ODBC API to perform data manipulation.

The ODBC provider does not expose any property to allow an OLE DBapplication to enable connection pooling. In order to enable connectionpooling, the OLE DB application needs to use the ODBC API to enableconnection pooling before using the ODBC provider. Because connectionpooling is a process-level attribute, any subsequent connection madethrough the ODBC provider will be using connection pooling.

The following code demonstrates how an OLE DB application can enableconnection pooling:
   SQLAllocEnv(&henv);   //enable connection pooling      SQLSetEnvAttr(         NULL,         SQL_ATTR_CONNECTION_POOLING,         (SQLPOINTER)SQL_CP_ONE_PER_DRIVER,         SQL_IS_INTEGER);   SQLAllocConnect(henv,&hdbc);   // connect to the OLE DB ODBC provider         OleInitialize(NULL);...      hr = CoCreateInstance( CLSID_MSDASQL, NULL, CLSCTX_INPROC_SERVER,         IID_IDBInitialize, (void **)&pIDBInit );...      CoUninitialize();   //finish OLE DB stuff     SQLFreeConnect(hdbc);     SQLFreeEnv(henv);   //disable connection pooling      SQLSetEnvAttr(         NULL,  // make process level cursor pooling         SQL_ATTR_CONNECTION_POOLING,         (SQLPOINTER)SQL_CP_OFF,         SQL_IS_INTEGER);				
viper asp pool ado
Properties

Article ID: 166083 - Last Review: 03/18/2004 07:52:20 - Revision: 2.0

  • Microsoft Open Database Connectivity 3.0
  • Microsoft OLE DB 1.1
  • kbhowto kbprogramming KB166083
Feedback