Root Binder Object

The binding process is managed by the root binder object, which is an OLE DB object with a well-known CLSID. This CLSID, which is defined in Msdasc.h, is CLSID_RootBinder. The root binder object manages the mapping of URL namespaces to OLE DB providers.

The consumer instantiates the root binder object by calling CoCreateInstance on the CLSID of the root binder object, requesting an IBindResource interface pointer. When the root binder object has been instantiated, providers can register their provider binder objects with the root binder object through the IRegisterProvider interface. Each provider calls IRegisterProvider::SetURLMapping to tell the root binder about each URL namespace it can bind.

Consumers request bindings by calling IBindResource::Bind. When the root binder receives such a URL binding request, it decodes the URL to the extent needed to determine which provider most closely matches the URL and then looks up the CLSID of that provider's binder object. The root binder then instantiates the provider binder object and delegates the bind request to it.

Before calling IBindResource::Bind, the consumer can call IDBBinderProperties::SetProperties on the root binder object to set any OLE DB properties, including provider-specific properties, that are needed for the bind operation. These properties are applied to all subsequent binds until the consumer calls IDBBinderProperties::Reset or IDBBinderProperties::SetProperties to reset or change the properties for subsequent IBindResource::Bind calls.

If IBindResource::Bind returns DB_E_ERRORSOCCURRED or DB_S_ERRORSOCCURRED, the consumer can immediately call IDBProperties::GetProperties with the DBPROPSET_PROPERTIESINERROR property set to return all the properties that were in error. For more information, see Property Sets in Appendix C: OLE DB Properties.

This topic is a part of:

Show: