The relationship between ODBC, OLE DB, and ADO

Source: Internet
Author: User
Tags driver manager odbc what odbc

After learning about. NET video, some of the concepts in the Database Connections section involved are very silent. Online a lot of relevant information, but in addition to the site is not the same, basically content is the same as God.

Now, I will see through the combination of some of the information to add their own understanding to try to explain, there is wrong, but also please advise!

Look at a picture:

Looking at the right half of the picture, let's take a look at the concept of ODBC.

1.ODBC:

To understand what ODBC is, learn about database connectivity first. In fact, in the first connection to the database, due to the wide variety of databases, various database connections have different requirements, this period, the database connection mainly rely on a variety of API functions to connect. ODBC is the encapsulation of these API functions to form a unified interface as shown (there is a unique interface above ODBC). The ODBC layer shown in the figure represents the drives (driver) of various databases in ODBC, and when the SQL statements enter the interface, the driver manager identifies them to the respective drives (driver), and the SQL statements are fed into various databases by the drive.

Do not know the above to write, there is not to the introduction of this ODBC to understand a little, learning to live, so it is easy to understand. Let me give you an example.

We think of ODBC as a car in which there is a driver (driver), which puts the following various database assumptions into different factories. If the driver receives a command (SQL statement) from the interface, it takes the goods from the car to a factory. Then the driver (driver) will, according to the type of goods specified in the order, identify exactly which factory they should enter in order to complete the mission.

As you can see, the commands received in the example above are like SQL statements in the database, so drivers are like drives (driver), and different factories are like different kinds of databases. Is there any simple way to understand this?

2.OLEDB and ODBC

Well, take a look at OLE DB, in the example above we understand ODBC, and we have to know that ODBC is responsible for the connection of a structured database. This will make it easier for us to understand OLE DB.

OLE DB, like ODBC, is a low-level interface that is responsible for database connections. OLE DB supports not only structured databases such as SQL Server,oracel access, but also non-structured data sources such as Excel.

OLE DB (object connection and embedded database) is a collection of objects, a method of reading and writing data. When using OLE DB, use the steps to initialize OLE, connect to the data source, issue commands, process the results, release the data source object, and stop initializing OLE. He can connect to the database through ODBC or connect to the database. When not through ODBC, this is where the components of the drive are not involved, so the database connection is faster at this time. At the same time, we can know that as long as ODBC-supported data sources are capable of supporting OLE DB. But the reverse is not necessarily true.

3.ADO

In the diagram, we see that ADO is between the application and OLE DB. It belongs to the high-level interface in the database connection.

is a COM component that is used to access the data source. It provides a programming language and uniform data access for an intermediate layer of OLE DB. Allows developers to write code that accesses data without worrying about how the database is implemented, but only the connections that are concerned with the database. When accessing a database, knowledge of SQL is not necessary, but SQL commands supported by a particular database can still be executed through the Command object in ADO.

How do you understand the above concept? In fact, we can contact the knowledge we learned about ADO controls. In the original study of VB, if we want to connect to the database, we must load a reference space, which contains connection,command,recordset and other related database connection objects, in fact, this reference is ADO. We establish a connection to the database through these objects, and we only need to write the code that accesses the database, not how the relational database is implemented.


These are the three concepts that I have combined and learned to understand. Many not thorough place, please everybody exchanges together.






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.