What is difference in adodb and oledb?
Asked Answered
P

2

48

What is the difference between adodb and oledb?

What is the relation between these two?

Where does ado.net stands in context of adodb and oledb?

Partisan answered 22/9, 2010 at 5:1 Comment(1)
possible duplicate of What are the pros and cons of OleDB versus SQLClient?Scudder
G
47

Adodb (ActiveX Data Objects DB) is an API layer over OLE DB. It works well with MS-based databases such as Sql Server, providing a consistent API and optimizations. That being said you can use ADODB to connect with non-MS data sources as well but that would mean that you will require an OLEDB/ODBC Provider for the data source.

In simpler terms, to connect to any data source you need a driver. Here are a couple of common scenarios to think of:

  1. ADODB for Data Source that has ODBC Driver Only - ADODB uses OLEDB Provider for ODBC which loads ODBC Driver which then connects to Data Source.
  2. ADODB for Data Source with OLEDB Driver (like SQL Server) - ADODB uses OLEDB Provider for SQL Server to talk directly with DB.

Oledb (Object Linking and Embedding DB) is a standard format supported by a large number of dbs, so you can connect to oracle, db2 etc. using Oledb. You can also use OLEDB directly to connect to Sql Server but the API is messier as compared to a adodb connection which is optimized to work with Sql Server and MS Access.

ADO.Net is a .Net based db connection "architecture". In ADO.Net there's a library for Oledb - System.Data.OledbClient. Adodb has been replaced/upgraded and ADO.Net now uses the System.Data.SqlClient library for MS-based databases/data providers.

Glazed answered 22/9, 2010 at 5:8 Comment(3)
you might have missed something out, Oledb can connet to msaccess. i use this oftenBerchtesgaden
That's very misleading. ADO is an API on top of OleDB and can work with any database that provides OleDB drivers, not just ones from Microsoft.Elson
Updated some parts of my answer to give a better understanding of these technologies.Glazed
E
20
  • ADO is a COM-based library for accessing databases.
  • OleDB and ODBC are standards for communicating with databases.
  • ADO uses the OleDB to talk to any database that exposes an OleDB driver.
  • There is also an OleDB driver that can wrap any ODBC driver. Thus ADO can also talk to any database that exposes an ODBC driver.

  • ADO.NET (a.k.a. System.Data) is a .NET based library for accessing databases.
  • ADO.NET has built-in support for SQL Server, OleDB, and ODBC
  • Third parties can expose their database to ADO.NET by building a ADO.NET compatible library
  • Third parties can also expose their database to ADO.NET by offering an OleDB or ODBC driver
Elson answered 5/5, 2016 at 23:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.