What is ole db? Introduction to ole db, oledb

Source: Internet
Author: User
Tags driver manager

What is ole db? Introduction to ole db, oledb

Ole db (OLEDB) is a strategic low-level application interface for Microsoft to access different data sources. Ole db not only supports the Structured Query Language (SQL) of Open Database Connectivity (ODBC), but also supports other non-SQL data types.

Introduction

OLE stands for Object Link and embed, that is, Object connection and embedding. As a design of Microsoft's Component Object Model (COM), ole db is a set of methods for reading and writing data (which may have been called a channel in the past ). Objects in ole db mainly include data source objects, stage objects, command objects, and row group objects. Applications using ole db use the following request sequence: initializing OLE to connect to the data source, issuing commands, processing results, releasing the data source Object, and stopping the initialization of OLE Object Linking and Embedding, object connection and embedding, OLE technology for short. OLE not only integrates desktop applications, but also defines and implements a mechanism that allows applications to be "connected" to each other as software "objects" (functions for integrating datasets and operating data, this connection mechanism and protocol are called the part object model. OLE is an object-oriented technology that allows you to develop reusable software components (COM ). DB (data base) is a set of data that is organized and stored in the second-level memory according to a certain data model.

Composition

Ole db is mainly composed of three parts: the Data provider that provides Data through ole db is the Data provider. For example, Data tables in the SQL Server database or Access database files with mdb names are all Data providers. Data Consumers all programs or components that use ole db to provide Data are ole db Data users. In other words, all applications or webpages using ADO are ole db data users. Service Components data Service Components can perform data transmission between data providers and data users. When a data user wants data from a data provider, the query is performed by the query processor of the ole db service component, and the query results are managed by the pointer engine.

New Concept

Ole db divides traditional database systems into multiple logical components, which are relatively independent and communicate with each other. Each part of this component model is named differently:

Data Provider

(Data Provider ). Software components that provide data storage, ranging from common text files to complex databases on hosts or email storage, are examples of data providers. Some documents refer to developers of these software components as data providers.

Data Service Provider

(Data Service Provider ). Function components located on top of the data provider, separated from the past database management system, and run independently, such as query processor and Cursor Engine ), these components enable the Data provided by the Data provider to be displayed in the form of Tabular Data (no matter how physical Data is organized and stored ), and Data Query and modification. The SQL Server 7.0 query handler is a typical example of this component. Business Component ). Data service providers are used to process specific business information and functional components that can be reused. The Middle layer (Middle-Tier) in the distributed database application system is a typical example of this component. Data Consumer ). In addition to typical database applications, any system program or application that needs to access data also includes development tools or languages that need to access various data sources.

Structure Design Problems

Before writing an ole db application, consider the following: Which programming implementation is used to compile the ole db application? Microsoft provides multiple libraries to solve this problem: the ole db template library, ole db attributes, and the original ole db interface in the ole db sdk. In addition, Microsoft provides a wizard to help you write programs. For more information about these implementations, see ole db templates, attributes, and Other implementations. Do you need to write your own provider? This is not required for most developers. Microsoft provides a variety of providers. No matter when a user creates a data connection, for example, when you use the atl ole db User Wizard to add a user to the project, the "Data Link Properties" dialog box lists all registered available providers in the system. If one of the providers is suitable for your own data storage and data access applications, the simplest way is to use the provider. However, if your data storage is not suitable for the provided category, you must create your own provider. For information about creating a provider, see the ole db Provider template and Its subtopics. What level of support does it provide to its users? Some users may be very simple, while others may be very complicated. The functions of ole db objects are specified by attributes. When you use the atl ole db User Wizard to create a user or use the database provider Wizard to create a provider, the wizard sets an appropriate object attribute for the user to provide a set of standard functions. However, if the user class or provider class generated by the wizard does not have all the support functions you need, you need to check the interfaces of these classes in the ole db template library. These interfaces encapsulate the original ole db interfaces and provide additional implementations to make them easier to use. For example, if you want to update data in the row set but forget to specify this function when creating a user using the wizard, after creating a user, you can set DBPROP_IRowsetChange and DBPROP_UPDATABILITY attributes for the command object to specify this function. In this way, after the row set is created, it will have the IRowsetChange interface. Do you have old code that uses other Data Access Technologies (ADO, ODBC, or DAO? There may be a wide variety of technical combinations (such as using ADO components and ole db components, and migrating ODBC code to ole db ), therefore, Visual C ++ documents cannot cover all situations.

Relationship between ole db and ODBC

Since the ole db and ODBC standards are designed to provide a unified interface for accessing data, some people once wondered: Does ole db replace the New ODBC standard? The answer is no. In fact, ODBC standard objects are SQL-Based Data sources, while OLE DB objects are more extensive in any Data storage. In this sense, ODBC-compliant data sources are a subset of ole db-compliant data storage. To comply with the ODBC standard, data sources must comply with the ole db standard and provide the corresponding ole db Service Provider, just as SQL Server must comply with the ODBC standard, the SQL Server ODBC driver must be provided. Now, Microsoft has provided a unified ole db service program for all ODBC data sources, called odbc ole db Provider. After the publication of odbc ole db Provider, some people worry: Is ODBC Provider a new Layer on ODBC )? If yes, will access the ODBC data source using ole db affect performance? The answer is no. In fact, the role of ODBC Provider is to replace ODBC Driver Manager, which serves as a bridge between applications and ODBC drivers and theoretically does not increase any overhead.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.