Building a Simple Provider: Step Summary
The OLE DB Simple Provider Toolkit simplifies the provider creation process. In most cases, you should only need to implement the OSP methods, code a data source object, fill out a copy of the supplied registration template, and register the OLE DB Simple Provider DLL (MSDAOSP.DLL) and the OSP Data Object (which will be a compiled DLL in Visual Basic and Visual C++, and a Java class in Visual J++). The other files supplied with each language implementation (header and library files) do not normally require modification.
Following is a summary of the main steps you need to follow when building a Simple Provider:
-
Choose a language. You can write a Simple Provider using Visual Basic, Visual C++, or Visual J++. The general process of creating a provider is the same in each environment, although certain implementation details vary. The Toolkit contains a set of code samples for each visual language.
-
Implement OSP. Most of your work will be implementing the OSP functions described in the OSP language reference. You can use the Toolkit's sample OSP implementation file in the language of your choice as a starting point, changing the implementations so that the methods work with your data.
-
Implement a data source object. You need to implement a data source object (as part of the OSP Data Object) to expose the correct OSP implementation to the OLE DB Simple Provider DLL (MSDAOSP.DLL). Use either IDataSource (in Visual C++ implementations) or msDataSourceObject and the appropriate IDispatch methods (in Visual Basic or Visual J++ implementations).
-
Implement notifications. Several of the OSP methods require notifications. Code your notifications in the OSP methods where applicable (for example, implementing the OSP notification methods aboutToChangeCell and cellChanged in the body of SetVariant).
-
Register the OLE DB Simple Provider DLL (MSDAOSP.DLL). Register MSDAOSP.DLL using regsvr32.exe.
-
Register the OSP Data Object. Once you have finished coding the OSP Data Object, you need to assign it a GUID and register it using regsvr32.exe (in Visual Basic and Visual C++ implementations) or javareg (in Visual J++).
-
Choose a registration option.
-
If you are fully registering a Simple Provider, you need to fill out a copy of the supplied registration template (the RegisterProvider.reg file) supplied with the Toolkit, and import that file's settings into the Windows registry. This eliminates the need to write code that loads the OSP Data Object and hands it off to MSDAOSP.DLL.
-
If you want to write your own consumer code to instantiate the provider, do not use the RegisterProvider.reg template file. (See Registration Without a .reg File.)