Skip to main content

Learning Microsoft Data Access Components (MDAC)

What is MDAC?

Microsoft Data Access Components (MDAC) is a suite of data access APIs that ship with the Windows operating system. In many cases, an older operating system can be retrofitted with a newer version of MDAC by running the redistributable installer package. MDAC includes three major API surfaces—ODBC, OLEDB, and ADO—each of which has been optimized for a different set of applications. All three major components of MDAC employ the provider model, which allows access to a variety of data sources using a virtually identical set of programmatic calls. Vendors of data sources not supported out-of-the-box, and interested third-parties, can enable access to additional data sources using the same familiar set of MDAC interfaces by supplying a provider for that data source.

What is ODBC?

Open Database Connectivity (ODBC) is a C language interface that allows developers to access databases in a fashion that does not depend on the software on the other end of the wire. For an introduction to ODBC programming, see the ODBC Programmer's Reference. ODBC is the most mature and popular API that is included in the current shipping version of MDAC.

What is OLEDB?

OLEDB was designed to provide a consistent developer experience and performant data access across a variety of data sources—some of which may not be databases at all. OLEDB leverages the C++ Active Template Libraries (ATL) to provide power to the developer while abstracting many complexities of COM programming. For an introduction to OLEDB programming, see the OLE DB Programmer's Guide.

What is ADO?

ActiveX Data Objects (ADO) is a simple data access technology that can used from Visual Basic, ASP, and Jscript (ADO can be used from C++, although this is a less common scenario). Behind the scenes, ADO is built on top of the OLEDB interfaces—giving the flexibility OLEDB's data source–agnostic programming model to ADO developers. For an introduction to ADO programming, see ADO Fundamentals.

Which interface is right for me?

Since ODBC and OLEDB cannot be used directly from scripting languages, if your application needs data access from Visual Basic or a scripting language such as VBScript, you should use ADO. If you are accessing data from C++, both ODBC and OLEDB are good options, and many factors could come into play making a decision. Therefore, we recommend reading about both and seeing which is better suited to the needs, architecture, and programming style of your application.

ODBC is generally considered the easier of the two APIs for many programmers to use, so if you are not sure which option is best, we would suggest you start with ODBC.

How do I deploy MDAC?

MDAC has shipped as part of the Windows Operating System since Windows 98, which means that you only need to deploy MDAC explicitly when the version of MDAC on an operating system targeted by your application is lower than the version required by your application. There are five versions of MDAC currently in support: 2.5 Service Pack 3, 2.7 Service Pack 1, 2.8 Gold, 2.8 Service Pack 1, and 2.8 Service Pack 2. All of these up to and including 2.8 Service Pack 2 are available as a redistributable package that your application can run during its install process. Be sure to test your data-aware application throughout in all of its target environments—although backward compatibility between MDAC versions is a design goal, the complexities of data access have been known to introduce discrepancies of behavior that cannot be fully reconciled. For information of redistributing MDAC, see Redistributing MDAC.