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

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

PPT
Ado
abhay singh
 
PDF
5c8605.ado.net
harkesh singh
 
PPT
Ado.net
Iblesoft
 
PDF
Presentation on the ADO.NET framework in C#
kittu57736
 
PPT
Database programming in vb net
Zishan yousaf
 
PPTX
5.C#
Raghu nath
 
PPTX
LECTURE 14 Data Access.pptx
AOmaAli
 
PPT
Introduction to ado.net
Paneliya Prince
 
PDF
Lee oracle
dhrumiljpatel
 
PPT
Introduction to ado
Harman Bajwa
 
PPTX
111111112222223333335555555666Unit-4.pptx
sachaniajay26
 
PPT
Lecture 6. ADO.NET Overview.
Alexey Furmanov
 
PPTX
Ado.net by Awais Majeed
Awais Majeed
 
PPT
Ado Net
Jiten Palaparthi
 
PPT
Ado.net
dina1985vlr
 
PPTX
Ado.net with asp.net
Sireesh K
 
PDF
Chapt 1 odbms
Sushil Kulkarni
 
PPTX
Ado.Net Tutorial
prabhu rajendran
 
DOC
Microsoft data access components
Shiva Krishna Chandra Shekar
 
PPTX
Data base connectivity and flex grid in vb
Amandeep Kaur
 
5c8605.ado.net
harkesh singh
 
Ado.net
Iblesoft
 
Presentation on the ADO.NET framework in C#
kittu57736
 
Database programming in vb net
Zishan yousaf
 
LECTURE 14 Data Access.pptx
AOmaAli
 
Introduction to ado.net
Paneliya Prince
 
Lee oracle
dhrumiljpatel
 
Introduction to ado
Harman Bajwa
 
111111112222223333335555555666Unit-4.pptx
sachaniajay26
 
Lecture 6. ADO.NET Overview.
Alexey Furmanov
 
Ado.net by Awais Majeed
Awais Majeed
 
Ado.net
dina1985vlr
 
Ado.net with asp.net
Sireesh K
 
Chapt 1 odbms
Sushil Kulkarni
 
Ado.Net Tutorial
prabhu rajendran
 
Microsoft data access components
Shiva Krishna Chandra Shekar
 
Data base connectivity and flex grid in vb
Amandeep Kaur
 

More from Arun Seetharaman (13)

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

Recently uploaded (20)

PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
PDF
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
Home Cleaning App Development Services.pdf
V3cube
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
“ONNX and Python to C++: State-of-the-art Graph Compilation,” a Presentation ...
Edge AI and Vision Alliance
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
Essential Content-centric Plugins for your Website
Laura Byrne
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PPTX
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
PPTX
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Home Cleaning App Development Services.pdf
V3cube
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
“ONNX and Python to C++: State-of-the-art Graph Compilation,” a Presentation ...
Edge AI and Vision Alliance
 
Digital Circuits, important subject in CS
contactparinay1
 
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Essential Content-centric Plugins for your Website
Laura Byrne
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
Ad

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