How Providers Work Effectively with Resource Pooling

OLE DB Programmer's Reference

To use OLE DB services, providers must support aggregation of all objects. This is a requirement of all OLE DB 1.5 and later providers. In addition, to work well with OLE DB resource pooling, providers must allow data source objects to be called on any thread, not just the one on which they were created. Specifically, providers must support the free thread model or, at minimum, the rental thread model. They must not be single or apartment threaded. The resource pool determines the thread model of the data source object by examining the value of the data source object's DBPROP_DSOTHREADMODEL property.

If the provider has a global connection state that might change while the data source object is in an initialized state, the provider should also support the DBPROP_RESETDATASOURCE property. This property is called before a connected data source object is reused, and gives the provider the opportunity to clean up the data source object's state. If the provider cannot clean up the data source object's state, it can return DBPROPSTATUS_NOTSETTABLE for the DBPROP_RESETDATASOURCE property and the data source object will not be reused.

Providers that connect to a remote database and can detect whether or not that connection may be lost should support the DBPROP_CONNECTIONSTATUS property. This property gives the OLE DB services the ability to detect dead connections and ensure that they are not returned to the pool.

Finally, automatic transaction enlistment must occur at the same level as resource pooling. Therefore, if a provider supports automatic transaction enlistment, it should support disabling it in favor of OLE DB automatic transaction enlistment, which occurs at the pooling level. To do this, the provider must support the DBPROP_INIT_OLEDBSERVICES property. OLE DB services will clear the DBPROPVAL_OS_TXNENLISTMENT flag when OLE DB automatic transaction enlistment is enabled. The provider should then disable its own support for automatic transaction enlistment.

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net