MDAC 2.5 SDK - OLE DB Providers
OSP Toolkit


 

Building a Simple Provider

The OLE DB Simple Provider (OSP) 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 Microsoft® Visual Basic® and in Microsoft Visual C++®, and a Java class in Microsoft 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:

  1. 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 OSP Toolkit contains a set of code samples for each visual language.

  2. Implement OSP. Most of your work will be in implementing the OSP functions described in the OSP Language Reference. You can use the OSP 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.

  3. Implement an OSP 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).

  4. 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).

  5. Register the OLE DB Simple Provider DLL (Msdaosp.dll). Register Msdaosp.dll using Regsvr32.exe.

  6. 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++).

  7. Choose a registration option.