This post shows you how to find Data Providers installed on a machine. Data providers in .NET Framework provide the plumbing necessary to connect to databases. There are different data providers available which can connect to SQL Server, Oracle or other databases through OleDb. You can find the data providers installed on your machine by looking at Machine.config file. In particular you will be looking for DbProviderFactories element under System.Data. In the screenshot below you can see data providers installed on my machine.

image

A list of data providers can also be retrieved by code. This sample shows you how to retrieve a list of data providers in code.

DataTable dataProviders = DbProviderFactories.GetFactoryClasses();

foreach (DataRow provider in dataProviders.Rows)
{
  Console.WriteLine(provider[0].ToString());
}  

In the code above I am displaying the name of provider. Here is my output.

image

Tagged with:
 

2 Responses to Find All Data Providers Installed On A Machine

  1. Ravikanth says:

    You can do the same thing in PowerShell by running this one-liner

    [System.Data.Common.DbProviderFactories]::GetFactoryClasses() | % { $_.Name }

  2. Deepak says:

    Thanks Ravikanth,

    Truly powerful :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>