Differences between ODBC, Dao, oledb, and ADO

Source: Internet
Author: User
Tags dsn odbc connection

ODBC(Open Database Connectivity, Open Database interconnection)

In 1992, Microsoft's wosa (windows open services architecture), a Database Component, established a set of specifications, it also provides a set of standard APIs for database access (application programming interfaces ). These APIs use SQL to complete most of their tasks. ODBC also provides support for the SQL language. You can directly send SQL statements to ODBC. --- The earliest appearance, but not always omnipotent.


Dao(Data Access Object)

In 1993, Microsoft revealed the Microsoft Jet Database Engine (first used for Microsoft Access and now supports other databases) and allowed developers to directly connect to other databases through ODBC, directly connect to the access table. Dao is most suitable for single-system applications or local distribution in a small range. Its internal access to the Jet Database has been accelerated and optimized, and it is also very convenient to use. Therefore, if the database is an Access database and is used locally, we recommend that you use this access method-application uniqueness.


Rdo(Remote Data Objects, Remote Data Object)

In 1995, rdo was an ODBC-oriented data access interface. It was combined with the easy-to-use DAO style and provided an interface, shows the underlying functions and flexibility of all ODBC databases. Although rdo is restricted in its access to jet or isam databases, it can only access relational databases through the existing ODBC driver. However, rdo has proved to be the best interface that many SQL Server, Oracle, and other large relational database developers often choose. Rdo provides more complex objects, attributes, and methods used to access stored procedures and complex result sets. --- It is undoubtedly based on ODBC


OLE DB(Object Linking and Embedding, database, object connection embedded database)

In 1997, Microsoft's strategic system-level programming interface was used to manage data throughout the organization. Ole db is an open specification built on the ODBC function. ODBC is specially developed to access relational databases. ole db is used to access relational and non-relational information sources, such as the host isam/VSAM and hierarchical database, email and file system storage, text, graphics, and geographic data, as well as custom business objects.

Ole db defines a set of COM interfaces, encapsulates various database management system services, and allows you to create software components to implement these services. Ole db components include data providers (including and presenting data), data users (using data), and service components (processing and transmitting data, such as query processors and cursor engines ).

Ole db interfaces help to smoothly integrate components, so that ole db Component vendors can quickly provide high-quality ole db components to the market. In addition, ole db contains a "bridge" Connecting ODBC, which provides consistent support for various ODBC relational database drivers. --- Claim to replace ODBC, but also compatible with ODBC

ADO(ActiveX Data Object)

In 1996, ADO was a successor of Dao/rdo. Ado 2.0 is more functionally similar to rdo, and generally there is a similar ing between the two models. Ado "extends" the object model used by Dao and rdo, which means it contains fewer objects, more attributes, methods (and parameters), and events. As the latest database access mode, ADO is also easy to use, so Microsoft has clearly stated that it will focus on ADO in the future and will not upgrade Dao/rdo, therefore, ADO has become the mainstream of database development.
Ado involves three Data Storage Methods: DSN (data source name), ODBC (open data connection), and ole db. The following routine will explain in detail the specific access implementation of these three methods. --- It can be said that it is the integration of system-level programming interfaces such as ODBC and oledb, and the upgrade of application-level programming interfaces such as Dao and rdo.

 

ODBC, Dao, ADO, and oledb Database Connection Methods

ODBC is an underlying access technology. Therefore, ODBC APIs can be used by customer applications to set and control databases from the underlying layer to complete functions that cannot be completed by advanced database technologies; however, ODBC can only be used for relational databases, making it difficult to Use ODBC to access object databases and other non-relational databases.

Dao provides a mechanism for creating and manipulating databases through program code. The biggest feature is that it is convenient to operate the Microsoft Jet Database and is one of the best technical interfaces for operating the Jet Database. In addition, it is not only used to access such databases. In fact, DAO technology can be used to access various data formats, such as text files and large backend databases.

ADO is an access interface based on ole db. It is an object-oriented ole db Technology and inherits the advantages of ole db. It is a high-level interface for database access.


Glossary:

ODBC (Open Database Connectivity) Open Database interconnection. It is a database connection Standard dominated by Microsoft.

MFC (Microsoft Foundation Class) Microsoft basic class. Mfc odbc is an encapsulation of ODBC.

Dao (Data Access Object) Data Access Object. Remote access is not provided.

Rdo (Remote Data Object) Remote Data Object. It is fast and supports SQL Server Stored Procedures. Like Dao, it has been developing for many years.

OLE-DB (Object Linking and Embedding database) object link and embedded database. It depends on COM and the vendors that provide ole db providers, rather than the SQL statements used by ODBC.

ActiveX Data Object (ADO) ActiveX Data Object. Local and remote database access based on OLE-DB. Be "Younger" like OLE-DB.

In use, we generally use OLE-DB and ADO to replace Dao and rdo.


Relationship between ADO and oledb

Oledb is an interface for accessing underlying data. It is an application used by third-party drivers to develop and output data sources to ado-technology, or a database component developed and customized by C ++ developers.

Ole db is an important system-level programming interface used to access data. It is the basic technology of ADO and also the data source of ADO. net.

ADO is an access interface based on ole db. It is an object-oriented ole db Technology and inherits the advantages of ole db. It is a high-level interface for database access.

In this case, ADO provides high-level application API functions for oledb.



Connection Methods of various data interfaces

I. ADO connection
1. Connect to the Access Database

Set conn = server. Createobject ("ADODB. Connection ")

Conn. Open "driver = {Microsoft Access Driver (*. mdb)}; DBQ =" & server. mappath ("dbname (path full name )")

2. Connect to the SQL Server database

Set conn = server. Createobject ("ADODB. Connection ")

SQL = "driver = {SQL Server}; server = (local); uid = sa; Pwd = sa; database = dbname"

Conn. Open (SQL)

Ii. ODBC connection (data source must be registered first --- DSN)

(List and configure the SQL Server database file DSN, open the management tool --- data source (ODBC) --- open the system DSN tab --- click Add button --- Select SQL server from the list, click Finish --- enter the database name in the name, and enter (local) in the SQL Server server you want to connect --- follow the wizard prompts to complete)

1. Connect to the Access Database

Set conn = server. Createobject ("ADODB. Connection ")

Conn. Open "DSN = registration name"

2. Connect to the SQL Server database

Set conn = server. Createobject ("ADODB. Connection ")

Conn. connectionstring = "DSN = Registration Name; uid = sa; Pwd = sa ;"

Conn. Open

3. oledb connecting to the database
1. Connect to the Access Database

Set conn = server. Createobject ("ADODB. Connection ")

Conn. Open "provider = Microsoft. Jet. oledb.4.0; Data Source =" & server. mappath ("dbname (full path name)") & "; persist Security info = false"

Set rs = server. Createobject ("ADODB. recordset ")

2. Connect to the SQL Server database

Set conn = server. Createobject ("ADODB. Connection ")

SQL = "provider = sqloledb; Data Source = (local); initial catalog = dbname; user id = sa; Password = sa ;"

Conn. Open (SQL)

Share:

ODBC(Open Database Connectivity, Open Database interconnection)

In 1992, Microsoft's wosa (windows open services architecture), a Database Component, established a set of specifications, it also provides a set of standard APIs for database access (application programming interfaces ). These APIs use SQL to complete most of their tasks. ODBC also provides support for the SQL language. You can directly send SQL statements to ODBC. --- The earliest appearance, but not always omnipotent.


Dao(Data Access Object)

In 1993, Microsoft revealed the Microsoft Jet Database Engine (first used for Microsoft Access and now supports other databases) and allowed developers to directly connect to other databases through ODBC, directly connect to the access table. Dao is most suitable for single-system applications or local distribution in a small range. Its internal access to the Jet Database has been accelerated and optimized, and it is also very convenient to use. Therefore, if the database is an Access database and is used locally, we recommend that you use this access method-application uniqueness.


Rdo(Remote Data Objects, Remote Data Object)

In 1995, rdo was an ODBC-oriented data access interface. It was combined with the easy-to-use DAO style and provided an interface, shows the underlying functions and flexibility of all ODBC databases. Although rdo is restricted in its access to jet or isam databases, it can only access relational databases through the existing ODBC driver. However, rdo has proved to be the best interface that many SQL Server, Oracle, and other large relational database developers often choose. Rdo provides more complex objects, attributes, and methods used to access stored procedures and complex result sets. --- It is undoubtedly based on ODBC


OLE DB(Object Linking and Embedding, database, object connection embedded database)

In 1997, Microsoft's strategic system-level programming interface was used to manage data throughout the organization. Ole db is an open specification built on the ODBC function. ODBC is specially developed to access relational databases. ole db is used to access relational and non-relational information sources, such as the host isam/VSAM and hierarchical database, email and file system storage, text, graphics, and geographic data, as well as custom business objects.

Ole db defines a set of COM interfaces, encapsulates various database management system services, and allows you to create software components to implement these services. Ole db components include data providers (including and presenting data), data users (using data), and service components (processing and transmitting data, such as query processors and cursor engines ).

Ole db interfaces help to smoothly integrate components, so that ole db Component vendors can quickly provide high-quality ole db components to the market. In addition, ole db contains a "bridge" Connecting ODBC, which provides consistent support for various ODBC relational database drivers. --- Claim to replace ODBC, but also compatible with ODBC

ADO(ActiveX Data Object)

In 1996, ADO was a successor of Dao/rdo. Ado 2.0 is more functionally similar to rdo, and generally there is a similar ing between the two models. Ado "extends" the object model used by Dao and rdo, which means it contains fewer objects, more attributes, methods (and parameters), and events. As the latest database access mode, ADO is also easy to use, so Microsoft has clearly stated that it will focus on ADO in the future and will not upgrade Dao/rdo, therefore, ADO has become the mainstream of database development.
Ado involves three Data Storage Methods: DSN (data source name), ODBC (open data connection), and ole db. The following routine will explain in detail the specific access implementation of these three methods. --- It can be said that it is the integration of system-level programming interfaces such as ODBC and oledb, and the upgrade of application-level programming interfaces such as Dao and rdo.

 

ODBC, Dao, ADO, and oledb Database Connection Methods

ODBC is an underlying access technology. Therefore, ODBC APIs can be used by customer applications to set and control databases from the underlying layer to complete functions that cannot be completed by advanced database technologies; however, ODBC can only be used for relational databases, making it difficult to Use ODBC to access object databases and other non-relational databases.

Dao provides a mechanism for creating and manipulating databases through program code. The biggest feature is that it is convenient to operate the Microsoft Jet Database and is one of the best technical interfaces for operating the Jet Database. In addition, it is not only used to access such databases. In fact, DAO technology can be used to access various data formats, such as text files and large backend databases.

ADO is an access interface based on ole db. It is an object-oriented ole db Technology and inherits the advantages of ole db. It is a high-level interface for database access.


Glossary:

ODBC (Open Database Connectivity) Open Database interconnection. It is a database connection Standard dominated by Microsoft.

MFC (Microsoft Foundation Class) Microsoft basic class. Mfc odbc is an encapsulation of ODBC.

Dao (Data Access Object) Data Access Object. Remote access is not provided.

Rdo (Remote Data Object) Remote Data Object. It is fast and supports SQL Server Stored Procedures. Like Dao, it has been developing for many years.

OLE-DB (Object Linking and Embedding database) object link and embedded database. It depends on COM and the vendors that provide ole db providers, rather than the SQL statements used by ODBC.

ActiveX Data Object (ADO) ActiveX Data Object. Local and remote database access based on OLE-DB. Be "Younger" like OLE-DB.

In use, we generally use OLE-DB and ADO to replace Dao and rdo.


Relationship between ADO and oledb

Oledb is an interface for accessing underlying data. It is an application used by third-party drivers to develop and output data sources to ado-technology, or a database component developed and customized by C ++ developers.

Ole db is an important system-level programming interface used to access data. It is the basic technology of ADO and also the data source of ADO. net.

ADO is an access interface based on ole db. It is an object-oriented ole db Technology and inherits the advantages of ole db. It is a high-level interface for database access.

In this case, ADO provides high-level application API functions for oledb.



Connection Methods of various data interfaces

I. ADO connection
1. Connect to the Access Database

Set conn = server. Createobject ("ADODB. Connection ")

Conn. Open "driver = {Microsoft Access Driver (*. mdb)}; DBQ =" & server. mappath ("dbname (path full name )")

2. Connect to the SQL Server database

Set conn = server. Createobject ("ADODB. Connection ")

SQL = "driver = {SQL Server}; server = (local); uid = sa; Pwd = sa; database = dbname"

Conn. Open (SQL)

Ii. ODBC connection (data source must be registered first --- DSN)

(List and configure the SQL Server database file DSN, open the management tool --- data source (ODBC) --- open the system DSN tab --- click Add button --- Select SQL server from the list, click Finish --- enter the database name in the name, and enter (local) in the SQL Server server you want to connect --- follow the wizard prompts to complete)

1. Connect to the Access Database

Set conn = server. Createobject ("ADODB. Connection ")

Conn. Open "DSN = registration name"

2. Connect to the SQL Server database

Set conn = server. Createobject ("ADODB. Connection ")

Conn. connectionstring = "DSN = Registration Name; uid = sa; Pwd = sa ;"

Conn. Open

3. oledb connecting to the database
1. Connect to the Access Database

Set conn = server. Createobject ("ADODB. Connection ")

Conn. Open "provider = Microsoft. Jet. oledb.4.0; Data Source =" & server. mappath ("dbname (full path name)") & "; persist Security info = false"

Set rs = server. Createobject ("ADODB. recordset ")

2. Connect to the SQL Server database

Set conn = server. Createobject ("ADODB. Connection ")

SQL = "provider = sqloledb; Data Source = (local); initial catalog = dbname; user id = sa; Password = sa ;"

Conn. Open (SQL)

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.