SlideShare a Scribd company logo
OLE DB PROVIDER
DEVELOPMENT
Arun Seetharaman
Computer Call
January 20, 1999
AGENDA
• Universal Data Access
• What is an OLE DB provider?
• Creating an OLE DB provider with the OLE DB Provider
Templates
• Extending the provider
• Questions and answers
Data
access
Universal Data Access
WHAT IS AN OLE DB
DATA PROVIDER?
• Implements core OLE DB interfaces
• Common interfaces to native functionality
• Does not require data to look like a relational
database
• Implements extended OLE DB interfaces to
expose native extended functionality
SCENARIOS
• Relational Data
• ODBC Driver exists, No OLE DB Provider
• You App uses ADO to talk to OLE DB Provider for ODBC ,
which talks to the ODBC driver
◆ Relational Data
⚫ OLE DB Provider exists
⚫ You App uses ADO to talk to OLE DB Provider
SCENARIOS
• Data in Exchange Server
• OLE DB Provider exists, No Query Engine
• You App uses ADO to talk to MS Exchange OLE DB Provider,
calls upon a Query Processor component to handle querying
◆ Data in NT File System
⚫ OLE DB Provider over Microsoft Index Server
⚫ You App uses ADO to talk to OLE DB Provider
WHY WRITE A PROVIDER?
• To participate in Universal Data Access:
⚫ Take advantage of ADO to provide C/C++,
Java , Visual Basic®, IIS and OLE
Automation programmers easy access to
your data
⚫ Expose your data to SQL Server , Access,
Excel, and third-party consumers
⚫ Add power to your data through common
Query Processor, Cursor, Notification, and
Remoting components
⚫ Participate in heterogeneous joins
PROVIDER TEMPLATE SUPPORT
• You could implement a bunch
of interfaces
• OLE DB Provider Templates
• Implements 20 of the most common OLE DB interfaces
• New option in ATL Object Wizard
• Minimal providers ready to go
in ten minutes
PROVIDER TEMPLATE SUPPORT
• Implements data source, session, command, and rowset
objects
• Implements all mandatory interfaces
• Minimal case:
• Developer changes PROVIDER_COLUMN_MAP and Execute()
• Significant case:
• Developer adds in additional objects
and interfaces
CreateSession()
Session
IDBCreateCommand
IOpenRowset
Execute()
Rowset
Rowset
OpenRowset()
Command
ICommand
CreateCommand()
OLE DB PROVIDER STRUCTURE
Data Source
IDBCreateSession
PROPERTIES
• Can be set Objectwise
• Defines Object specific behaviour
• Type, Value, Read/Write attribute
• Property Sets
• Properties with the same GUID
• Many are Pre-defined in OLEDB
• Provider can define custom properties
GUID : PropertySet A
Count: 3
Pointer :
DBPROPSET Array
ID: Property 1
Value : Value1
ID: Property 2
Value : Value2
ID: Property 1
Value : Value1
GUID : PropertySet A
Count: 3
Pointer :
DBPROPIDSET Array
Property 1
Property 2
Property 3
DBPROPID Arrays
DATA SOURCE INTERFACES
• IDBProperties
• Sets properties used in initialization
• Returns information about
provider's capabilities
• Data Source Properties
Data Source Name, Version, Threading Model
• Initialization Properties
User ID, Password, Locale ID, Timeout
DATA SOURCE INTERFACES
• IDBInitialize
• Connects to the provider
• State Change to ‘Initialized’
◆ IDBCreateSession
⚫ Gets a session object
◆ IPersist
⚫ Returns your CLSID
⚫ To persist Connection Information
SESSION INTERFACES
• IGetDataSource
• Returns parent datasource
• ISessionProperties
• Sets properties on session
Transaction Isolation Levels Supported in Auto-Commit Mode
SESSION INTERFACES
• IOpenRowset
• To Work directly with Table
• No overhead of Query Language support
◆ IDBCreateCommand (Optional)
⚫ Only if you support commands
COMMAND INTERFACES
• ICommandProperties
• Set properties for open rowset
◆ ICommandText
⚫ Set and execute command
COMMAND INTERFACES
• IAccessor
• Defines how parameters are read
• Binds each column or parameter to Consumer’s buffer
◆ IColumnsInfo
⚫ Provides metadata about Columns
ROWSET OBJECT
People
Name Address Papers Picture Voice
David
Mike
Monica
NY
CA
DC
...
IStream
IRowset
IDraw IPlay
ROWSET OBJECT
• Universal abstraction for tabular data
• Base data, query results,
computed data, schema…
◆ Rows can contain COM objects
◆ Efficient, streamlined access to large objects
ROWSET OBJECT
• Rowset data can be shared
⚫ Multiple Consumers
⚫ Multiple Components
⚫ Notifications
⚫ Deferred/Immediate Updates
ROWSET INTERFACES
• IColumnsInfo
• Describes the columns of the rowset
◆ IAccessor
⚫ Defines how consumer reads data
◆ IRowsetInfo
⚫ Returns rowset properties
 Updatability, Bookmarks ...
⚫ Interface Support
 Find, Conversions ...
ROWSET INTERFACES
• IRowset
• GetNextRows retrieves row handles
• GetData reads data from row handles
◆ IConvertType
⚫ Use the Data Conversion library
CREATING AN OLE DB PROVIDER
• Run the OLE DB Provider Wizard
• Generates COM objects for data source, session,
command, and rowset
• Modify and extend code
class CAgentMan
{
public:
TCHAR szCommand[256];
TCHAR szText[256];
BEGIN_PROVIDER_COLUMN_MAP(CAgentMan)
PROVIDER_COLUMN_ENTRY(“Field1”, 1, szCommand)
PROVIDER_COLUMN_ENTRY(“Field2”, 2, szText)
END_PROVIDER_COLUMN_MAP()
};
MODIFY DATA STRUCTURE
• Represents one row of data
• Contains data members and meta-data
HRESULT Execute(DBPARAMS * pParams, LONG* pcRowsAffected)
{
...
}
MODIFY EXECUTE IN ROWSET
• Command is stored in m_strCommandText
• Create instances of your
data structure
• Place instances in m_rgRowData
• Set pcRowsAffected
DEMO
• Creating a minimal provider
• Run Provider Wizard
• Modify data structure
• Modify PROVIDER_COLUMN_MAP
• Modify Execute()
EXTENDING THE PROVIDER
• Schema rowsets
• Properties
• Add in validation routines
• Add additional OLE DB interfaces
CONFORMANCE TESTS
• Generic OLE DB tests that:
• Verify conformance to minimum level
• Test correctness of exposed interfaces
• Based on sample test suites
in OLE DB SDK
• Provide a performance benchmark
• Include ADO acceptance tests
SUMMARY
• Writing a provider gives you…
• C/C++, OLE Automation, Java,
and scripting access to your data through ADO
• Exposure to Microsoft® and third-party tools, products, and
components

More Related Content

PDF
OLE DB 2.0 Architecture - Supporting Remote Data Exchange
PPTX
Building RESTfull Data Services with WebAPI
PPTX
Sap bods Training in Hyderabad | Sap bods Online Training
PPTX
Sap bods training in hyderabad
PPT
Rajnish singh(presentation on oracle )
PPT
Asp #2
PPT
PI-RDBMS.ppt
PPTX
Building Software Backend (Web API)
OLE DB 2.0 Architecture - Supporting Remote Data Exchange
Building RESTfull Data Services with WebAPI
Sap bods Training in Hyderabad | Sap bods Online Training
Sap bods training in hyderabad
Rajnish singh(presentation on oracle )
Asp #2
PI-RDBMS.ppt
Building Software Backend (Web API)

Similar to OLE DB Provider Development - Encapsulating a Service Provider (20)

PPTX
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
PPTX
For Beginners - Ado.net
PPTX
Doctrine 2.0 Enterprise Persistence Layer for PHP
PDF
Azure Data Factory V2; The Data Flows
PPTX
Sage 300 ERP: Technical Tour of Diagnostic Tools
PDF
Micro strategy 7i
PDF
Bye bye $GLOBALS['TYPO3_DB']
PDF
What's New in Apache Hive 3.0?
PDF
What's New in Apache Hive 3.0 - Tokyo
PDF
Big Data Developers Moscow Meetup 1 - sql on hadoop
PDF
Informatica slides
PPT
MySQL, LINQ and the ADO_NET Entity Framework Presentation.ppt
PDF
Azure - Data Platform
PPTX
Data Modeling on Azure for Analytics
PPT
Oracle database connection with the .net developers
PPT
kjdiakdnfdifjadsjkjklljlldasgjdjdljgfldjgldjgldjgl.ppt
PPT
ow.ppt
PPTX
Build a modern data platform.pptx
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
For Beginners - Ado.net
Doctrine 2.0 Enterprise Persistence Layer for PHP
Azure Data Factory V2; The Data Flows
Sage 300 ERP: Technical Tour of Diagnostic Tools
Micro strategy 7i
Bye bye $GLOBALS['TYPO3_DB']
What's New in Apache Hive 3.0?
What's New in Apache Hive 3.0 - Tokyo
Big Data Developers Moscow Meetup 1 - sql on hadoop
Informatica slides
MySQL, LINQ and the ADO_NET Entity Framework Presentation.ppt
Azure - Data Platform
Data Modeling on Azure for Analytics
Oracle database connection with the .net developers
kjdiakdnfdifjadsjkjklljlldasgjdjdljgfldjgldjgldjgl.ppt
ow.ppt
Build a modern data platform.pptx
Ad

More from Arun Seetharaman (13)

PDF
Implementing Load Balancing in COM+ Applications
PDF
Advanced Windows DNA Scripting with Visual InterDev
PDF
Implementing DHTML Behavior Script Components
PDF
Creating Data-based Applications Using DHTML
PDF
COM Events for Late-bound Delivery of Information
PDF
Understanding Windows NT Internals - Part 4
PDF
Understanding Windows NT Internals - Part 5
PDF
Understanding Windows NT Internals - Part 3
PDF
Understanding Windows NT Internals - Part 1
PDF
Understanding Windows NT Internals - Part 2
PDF
Data Structures in Java and Introduction to Collection Framework
PDF
AWT Enhancements in V1.1 - Supporting Richer GUI Development
PDF
Java Foundation Classes - Building Portable GUIs
Implementing Load Balancing in COM+ Applications
Advanced Windows DNA Scripting with Visual InterDev
Implementing DHTML Behavior Script Components
Creating Data-based Applications Using DHTML
COM Events for Late-bound Delivery of Information
Understanding Windows NT Internals - Part 4
Understanding Windows NT Internals - Part 5
Understanding Windows NT Internals - Part 3
Understanding Windows NT Internals - Part 1
Understanding Windows NT Internals - Part 2
Data Structures in Java and Introduction to Collection Framework
AWT Enhancements in V1.1 - Supporting Richer GUI Development
Java Foundation Classes - Building Portable GUIs
Ad

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Electronic commerce courselecture one. Pdf
PPTX
Machine Learning_overview_presentation.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
cuic standard and advanced reporting.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
sap open course for s4hana steps from ECC to s4
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
Big Data Technologies - Introduction.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation theory and applications.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine learning based COVID-19 study performance prediction
Programs and apps: productivity, graphics, security and other tools
Electronic commerce courselecture one. Pdf
Machine Learning_overview_presentation.pptx
Network Security Unit 5.pdf for BCA BBA.
cuic standard and advanced reporting.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
sap open course for s4hana steps from ECC to s4
The AUB Centre for AI in Media Proposal.docx
NewMind AI Weekly Chronicles - August'25-Week II
Big Data Technologies - Introduction.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation theory and applications.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MIND Revenue Release Quarter 2 2025 Press Release
20250228 LYD VKU AI Blended-Learning.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf

OLE DB Provider Development - Encapsulating a Service Provider

  • 1. OLE DB PROVIDER DEVELOPMENT Arun Seetharaman Computer Call January 20, 1999
  • 2. AGENDA • Universal Data Access • What is an OLE DB provider? • Creating an OLE DB provider with the OLE DB Provider Templates • Extending the provider • Questions and answers
  • 4. WHAT IS AN OLE DB DATA PROVIDER? • Implements core OLE DB interfaces • Common interfaces to native functionality • Does not require data to look like a relational database • Implements extended OLE DB interfaces to expose native extended functionality
  • 5. SCENARIOS • Relational Data • ODBC Driver exists, No OLE DB Provider • You App uses ADO to talk to OLE DB Provider for ODBC , which talks to the ODBC driver ◆ Relational Data ⚫ OLE DB Provider exists ⚫ You App uses ADO to talk to OLE DB Provider
  • 6. SCENARIOS • Data in Exchange Server • OLE DB Provider exists, No Query Engine • You App uses ADO to talk to MS Exchange OLE DB Provider, calls upon a Query Processor component to handle querying ◆ Data in NT File System ⚫ OLE DB Provider over Microsoft Index Server ⚫ You App uses ADO to talk to OLE DB Provider
  • 7. WHY WRITE A PROVIDER? • To participate in Universal Data Access: ⚫ Take advantage of ADO to provide C/C++, Java , Visual Basic®, IIS and OLE Automation programmers easy access to your data ⚫ Expose your data to SQL Server , Access, Excel, and third-party consumers ⚫ Add power to your data through common Query Processor, Cursor, Notification, and Remoting components ⚫ Participate in heterogeneous joins
  • 8. PROVIDER TEMPLATE SUPPORT • You could implement a bunch of interfaces • OLE DB Provider Templates • Implements 20 of the most common OLE DB interfaces • New option in ATL Object Wizard • Minimal providers ready to go in ten minutes
  • 9. PROVIDER TEMPLATE SUPPORT • Implements data source, session, command, and rowset objects • Implements all mandatory interfaces • Minimal case: • Developer changes PROVIDER_COLUMN_MAP and Execute() • Significant case: • Developer adds in additional objects and interfaces
  • 11. PROPERTIES • Can be set Objectwise • Defines Object specific behaviour • Type, Value, Read/Write attribute • Property Sets • Properties with the same GUID • Many are Pre-defined in OLEDB • Provider can define custom properties
  • 12. GUID : PropertySet A Count: 3 Pointer : DBPROPSET Array ID: Property 1 Value : Value1 ID: Property 2 Value : Value2 ID: Property 1 Value : Value1 GUID : PropertySet A Count: 3 Pointer : DBPROPIDSET Array Property 1 Property 2 Property 3 DBPROPID Arrays
  • 13. DATA SOURCE INTERFACES • IDBProperties • Sets properties used in initialization • Returns information about provider's capabilities • Data Source Properties Data Source Name, Version, Threading Model • Initialization Properties User ID, Password, Locale ID, Timeout
  • 14. DATA SOURCE INTERFACES • IDBInitialize • Connects to the provider • State Change to ‘Initialized’ ◆ IDBCreateSession ⚫ Gets a session object ◆ IPersist ⚫ Returns your CLSID ⚫ To persist Connection Information
  • 15. SESSION INTERFACES • IGetDataSource • Returns parent datasource • ISessionProperties • Sets properties on session Transaction Isolation Levels Supported in Auto-Commit Mode
  • 16. SESSION INTERFACES • IOpenRowset • To Work directly with Table • No overhead of Query Language support ◆ IDBCreateCommand (Optional) ⚫ Only if you support commands
  • 17. COMMAND INTERFACES • ICommandProperties • Set properties for open rowset ◆ ICommandText ⚫ Set and execute command
  • 18. COMMAND INTERFACES • IAccessor • Defines how parameters are read • Binds each column or parameter to Consumer’s buffer ◆ IColumnsInfo ⚫ Provides metadata about Columns
  • 19. ROWSET OBJECT People Name Address Papers Picture Voice David Mike Monica NY CA DC ... IStream IRowset IDraw IPlay
  • 20. ROWSET OBJECT • Universal abstraction for tabular data • Base data, query results, computed data, schema… ◆ Rows can contain COM objects ◆ Efficient, streamlined access to large objects
  • 21. ROWSET OBJECT • Rowset data can be shared ⚫ Multiple Consumers ⚫ Multiple Components ⚫ Notifications ⚫ Deferred/Immediate Updates
  • 22. ROWSET INTERFACES • IColumnsInfo • Describes the columns of the rowset ◆ IAccessor ⚫ Defines how consumer reads data ◆ IRowsetInfo ⚫ Returns rowset properties  Updatability, Bookmarks ... ⚫ Interface Support  Find, Conversions ...
  • 23. ROWSET INTERFACES • IRowset • GetNextRows retrieves row handles • GetData reads data from row handles ◆ IConvertType ⚫ Use the Data Conversion library
  • 24. CREATING AN OLE DB PROVIDER • Run the OLE DB Provider Wizard • Generates COM objects for data source, session, command, and rowset • Modify and extend code
  • 25. class CAgentMan { public: TCHAR szCommand[256]; TCHAR szText[256]; BEGIN_PROVIDER_COLUMN_MAP(CAgentMan) PROVIDER_COLUMN_ENTRY(“Field1”, 1, szCommand) PROVIDER_COLUMN_ENTRY(“Field2”, 2, szText) END_PROVIDER_COLUMN_MAP() }; MODIFY DATA STRUCTURE • Represents one row of data • Contains data members and meta-data
  • 26. HRESULT Execute(DBPARAMS * pParams, LONG* pcRowsAffected) { ... } MODIFY EXECUTE IN ROWSET • Command is stored in m_strCommandText • Create instances of your data structure • Place instances in m_rgRowData • Set pcRowsAffected
  • 27. DEMO • Creating a minimal provider • Run Provider Wizard • Modify data structure • Modify PROVIDER_COLUMN_MAP • Modify Execute()
  • 28. EXTENDING THE PROVIDER • Schema rowsets • Properties • Add in validation routines • Add additional OLE DB interfaces
  • 29. CONFORMANCE TESTS • Generic OLE DB tests that: • Verify conformance to minimum level • Test correctness of exposed interfaces • Based on sample test suites in OLE DB SDK • Provide a performance benchmark • Include ADO acceptance tests
  • 30. SUMMARY • Writing a provider gives you… • C/C++, OLE Automation, Java, and scripting access to your data through ADO • Exposure to Microsoft® and third-party tools, products, and components