ADO vs ADO.NET vs OLE DB vs ODBC [数据提供程序之间的差别]

简介:

What are the Microsoft Data Access Components?
The Microsoft Data Access Components (MDAC) are the key technologies that enable Universal Data Access. Data-driven client/server applications deployed over the Web or a LAN can use these components to easily integrate information from a variety of sources, both relational (SQL) and non relational. These components include Microsoft ActiveX Data Objects (ADO), OLE DB, and Open Database Connectivity (ODBC).


ActiveX Data Objects (ADO) 
ADO is the strategic application programming interface (API) to data and information. ADO provides consistent, high-performance access to data and supports a variety of development needs, including the creation of front-end database clients and middle-tier business objects that use applications, tools, languages, or Internet browsers. ADO is designed to be the one data interface needed for single and multi-tier client/server and Web-based data-driven solution development. The primary benefits of ADO are ease of use, high speed, low memory overhead, and a small disk footprint.
ADO provides an easy-to-use interface to OLE DB, which provides the underlying access to data. ADO is implemented minimal network traffic in key scenarios, and a minimal number of layers between the front end and data source-all to provide a lightweight, high-performance interface. ADO is easy to use because it uses a familiar metaphor-the COM automation interface, available from all leading Rapid Application Development (RAD) tools, database tools, and languages on the market today. ADO is a nice wrapper for OLD-DB.


OLE DB 
OLE-DB is the Microsoft strategic system-level programming interface to data across the organization. OLE DB is an open specification designed to build on the success of ODBC by providing an open standard for accessing all kinds of data. Whereas ODBC was created to access relational databases, OLE DB is designed for relational and non relational information sources, including mainframe ISAM/VSAM and hierarchical databases; e-mail and file system stores; text, graphical, and geographical data; custom business objects; and more.
OLE DB defines a collection of COM interfaces that encapsulate various database management system services. These interfaces enable the creation of software components that implement such services. OLE DB components consist of data providers, which contain and expose data; data consumers, which use data; and service components, which process and transport data (such as query processors and cursor engines). OLE DB interfaces are designed to help components integrate smoothly so that OLE DB component vendors can bring high-quality OLE DB components to market quickly. In addition, OLE DB includes a bridge to ODBC to enable continued support for the broad range of ODBC relational database drivers available today.


Open Database Connectivity (ODBC) 
The ODBC interface is an industry standard and a component of Microsoft Windows Open Services Architecture (WOSA). The ODBC interface makes it possible for applications to access data from a variety of database management systems (DBMSs). ODBC permits maximum interoperability-an application can access data in diverse DBMSs through a single interface. Furthermore, that application will be independent of any DBMS from which it accesses data. Users of the application can add software components called drivers, which create an interface between an application and a specific DBMS. 

When should you use OLE-DB, ADO, DAO, or ODBC ?

ADO is a wrapper around OLE-DB so you can use ADO or OLE-DB.
Non-OLE environment : If a database supports ODBC and and that database is on a server that don't support OLE then ODBC is your best choice. 
Non-SQL environment : ODBC is designed to work with SQL. If you have non-SQL environment then OLE-DB is better choice.
OLE environment : If you already have ODBC drives then you can use ODBC, otherwise use OLE-DB.
Interoperability required : If you need interoperable database components, then OLE-DB is your best choice.
16-Bit data access support : ADO don't support 16 bit so ODBC is the only choice.
Using multiple databases - If you are using databases that support Microsoft's jet engine then definite choice is ADO or DAO. By using ADO you get workspace level support for transaction. That means you can connect more than one database at a time in an application, which is impossible by using ODBC. You can only connect one database at a time by using ODBC.


ADO vs. DAO
ADO is a superset of DAO in functionality point of view. In fact ADO is a combination of DAO + RDO. I would prefer ADO in these cases. 1. If you are proficient in COM programming. 2. If your server supports OLE environment. 3. If you want workspace-level and multi database type ( Relational, indexed, ISAM type, text files supports ). DAO is best choice when you have DAO components installed on your machine and you are using Microsoft's jet database engine based databases such as MS-Access, SQL Server, MS-Excel or Paradox. This is fastest and easiest mathod o access databases.


DAO vs. ODBC
DAO is best choice when you have DAO components installed on your machine and you are using Microsoft's jet database engine based databases such as MS-Access, SQL Server, MS-Excel or Paradox. This is fastest and easiest method to access databases. ODBC is for various type of database which provides ODBC drives such as SQL Server, Oracle, MS-Access. Additional advantage is DAO is workspace-level support.


Advantages of DAO: Easy to use. Workspace level support. Both MFC and API provides DAO support. Speed is relatively faster than ODBC for jet database engine databases.


Advantages of ODBC : Easy to use specially when developer are not familiar with COM environment. SQL support. Both API and MFC support. Good for relational databases only.


Advantages of ADO or OLE-DB : Workspace-level support. Fastest method to access various kind of databases. Easy to use fi you are familiar with COM environment. Provides access to relational, non relational and other types of data.

 

其他参考资料:

Data Providers:
ODBC, while not slower than OLE-DB, is less featured than OLE-DB.  ODBC is still used where OLE-DB data providers are not available.  OLE-DB is the underlying data provider for ADO and ADO.NET's ".NET OLE-DB Data Provider".  The Native ADO.NET Data Providers are designed to support ADO.NET's strategy for implementing fast connections (only open while in use) and disconnected recordsets.  The other bonus is that the underlying data format is now XML.  In the end, the data providers have changed each time to support additional features of the data access API (ADO, ADO.NET).

Data Access Interfaces:
DAO/RDO = obsolete.  Meaning obsoleted by Microsoft and it's functionality and usefulness is completely eclipsed by ADO/RDS.
ADO is different from ADO.NET in that ADO required connections to be maintained when using things like data-bound controls, whereas ADO.NET can bind to controls using disconnected "recordsets" (DataSets is the proper term).  Connections and server-side cursors are expensive to maintain on a heavily used server as database servers allocate a set amount of base resources to be available for each connection, plus whatever resources are required for the cursor.

While, it was also the case in ADO that you could cache recordsets on the client, ADO had many less options with how you could present that data without doing a lot of custom code and looping.  ADO.NET's very flexible support for XML allows virtually unlimited transformations of the data.  ADO's support for XML recordsets was limited to a single ouput: the ADO XML stream, which used an annoying format that always had to be retransformed before use.


本文转自海天一鸥博客园博客,原文链接:http://www.cnblogs.com/sgsoft/archive/2011/06/21/2085654.html,如需转载请自行联系原作者

相关文章
|
6月前
mvc.net分页查询案例——DLL数据访问层(HouseDLL.cs)
mvc.net分页查询案例——DLL数据访问层(HouseDLL.cs)
|
1月前
|
SQL XML 关系型数据库
入门指南:利用NHibernate简化.NET应用程序的数据访问
【10月更文挑战第13天】NHibernate是一个面向.NET的开源对象关系映射(ORM)工具,它提供了从数据库表到应用程序中的对象之间的映射。通过使用NHibernate,开发者可以专注于业务逻辑和领域模型的设计,而无需直接编写复杂的SQL语句来处理数据持久化问题。NHibernate支持多种数据库,并且具有高度的灵活性和可扩展性。
40 2
|
6月前
|
XML 开发框架 .NET
LabVIEW中加载.NET 2.0,3.0和3.5程序集
LabVIEW中加载.NET 2.0,3.0和3.5程序集
148 4
|
1月前
|
XML 存储 安全
C#开发的程序如何良好的防止反编译被破解?ConfuserEx .NET混淆工具使用介绍
C#开发的程序如何良好的防止反编译被破解?ConfuserEx .NET混淆工具使用介绍
66 0
|
2月前
|
Ubuntu 持续交付 API
如何使用 dotnet pack 打包 .NET 跨平台程序集?
`dotnet pack` 是 .NET Core 的 NuGet 包打包工具,用于将代码打包成 NuGet 包。通过命令 `dotnet pack` 可生成 `.nupkg` 文件。使用 `--include-symbols` 和 `--include-source` 选项可分别创建包含调试符号和源文件的包。默认情况下,`dotnet pack` 会先构建项目,可通过 `--no-build` 跳过构建。此外,还可以使用 `--output` 指定输出目录、`-c` 设置配置等。示例展示了创建类库项目并打包的过程。更多详情及命令选项,请参考官方文档。
199 11
|
2月前
|
存储 运维
.NET开发必备技巧:使用Visual Studio分析.NET Dump,快速查找程序内存泄漏问题!
.NET开发必备技巧:使用Visual Studio分析.NET Dump,快速查找程序内存泄漏问题!
|
2月前
|
自然语言处理 C# 图形学
使用dnSpyEx对.NET Core程序集进行反编译、编辑和调试
使用dnSpyEx对.NET Core程序集进行反编译、编辑和调试
|
3月前
|
开发框架 .NET 数据库连接
闲话 Asp.Net Core 数据校验(三)EF Core 集成 FluentValidation 校验数据例子
闲话 Asp.Net Core 数据校验(三)EF Core 集成 FluentValidation 校验数据例子
|
4月前
|
开发框架 JSON 前端开发
利用查询条件对象,在Asp.net Web API中实现对业务数据的分页查询处理
利用查询条件对象,在Asp.net Web API中实现对业务数据的分页查询处理
|
4月前
|
Linux C# iOS开发
如何用 WinDbg 调试Linux上的 .NET程序
【7月更文挑战第13天】 1. `dotnet-dump`: Collects process dumps with `dotnet-dump collect -p <process_id>`. 2. `lldb`: Debugs Mono runtime apps on macOS/Linux. 3. **Visual Studio Code**: Remotely debugs .NET via the C# extension. 4. **JetBrains Rider**: Supports remote debugging of .NET on Linux.