This documentation is archived and is not being maintained.

Creating an OLE DB Provider

The recommended way to create an OLE DB provider is to use the wizards to create an ATL COM project and a provider and then modify the files using the OLE DB templates. As you customize your provider, you can comment out unwanted properties and add optional interfaces.

Note   The procedures in the following topics create the same provider as that in the MyProv sample; they use the provider name (short name) "MyProvider", but you can use another name. The sample code might differ from what is listed in the following topics, and you should regard the sample code as the more up-to-date version.

The basic steps are outlined below:

  1. Use the ATL Project Wizard to create the basic project files, and the ATL OLE DB Provider Wizard to create the provider (select ATL OLE DB Provider from the Visual C++ folder in Add Class).
  2. Modify the code in the Execute method in CMyProviderRS.h. (For an example, see Reading Strings Into an OLE DB Provider.)
  3. Edit the property maps in MyProviderDS.h, MyProviderSess.h, and MyProviderRS.h. The wizard creates property maps that contain all properties that a provider might implement. Go through the property maps and remove or comment out properties your provider does not need to support.
  4. Update the PROVIDER_COLUMN_MAP, which can be found in MyProviderRS.h. (See Storing Strings In the OLE DB Provider for an example.)
  5. When you are ready to test your provider, you can test it by trying to find the provider in a provider enumeration. For examples of test code that finds a provider in an enumeration, see the CATDB and DBVIEWER samples or the example in Implementing A Simple Consumer.
  6. Add any additional interfaces you desire. (See Enhancing the Simple Read-Only Provider for an example.)
    Note   By default, the wizards generate code that is OLE DB level 0 compliant. To ensure that your application remains level 0 compliant, do not remove any of the wizard-generated interfaces from the code.

See Also

MyProv | CATDB | DBVIEWER

Show: