What is data provider in C#?

What is data provider in C#?,Data Provider
Share it:
A data provider is the one that connects to the data source such as SQL Server. .NET provides you with different data providers not just for SQL Server. For example, you can use the Oracle and OLE DB data providers to connect to an Oracle or OLE DB databases respectively.

Data Provider

data provider

The following are some of the data providers provided by .NET.

Provider       Description
Sql Server    Provides access to a SQL Server database.
OLE DB      Provider Provides access to any data source that has an OLE DB driver such as MySQL,
Oracle         Provider Provides access to an Oracle database.
ODBC         Provider Provides access to any data source that has an ODBC driver.

Each data provider provides classes that you can use to access your database. For example, the data provider for SQL Server consists of SqlConnection, SqlCommand, SqlDataReader, and SqlDataAdapter. The data provider for Oracle consists of OracleConnection, OracleCommand, OracleDataReader, and OracleDataAdapter. The classes for the various providers inherit from a standard set of classes and implement a standard set of interfaces to supply consistent functionality no matter the provider.
Data Provider
Components       Sql Server           OLE DB                    Oracle                    ODBC
Connection      SqlConnection      OleDbConnection     OracleConnection OdbcConnection
Command        SqlCommand        OleDbCommand       OracleCommand   OdbcConnection
DataReader      SqlDataReader     OleDbDataReader   OracleDataReader  OdbcDataReader
DataAdapter    SqlDataAdapter    OleDbDataAdapter OleDbDataReader OleDbDataAdapter

Each data provider is found in its own namespace. For example, the Sql Provider is found inside System.Data.SqlClient and therefore the Ole DB provider is found inside System.Data.OleDb.

Data Provider Namespace
Sql Server System.Data.SqlClient
Ole DB System.Data.OleDb
Oracle System.Data.OracleClient
ODBC System.Data.Odbc

The classes inside these namespaces implements a common interface. Consider the SqlConnection and OleDbConnection for example. They both implement the interface IDbConnection. If you check out this interface, you'll see the common properties and methods of the Connection classes for all data providers.

Share it:

adonet

dotnet

sql

Post A Comment:

0 comments: