Writing a Generic Data Access Component - Flexible Approach

In response to Mahesh's article - Writing a Generic Data Access Component using ADO.NET Interfaces, here is one more flexible approach to achieve the same. I prefer this approach to generic data access.

using System;
using System.Data;
using System.Configuration;
public class DB
public static IDbConnection GetConnection()
Type cnType = Type.GetType(ConfigurationSettings.AppSettings("connectionType"));
DbConnection cn = (IDbConnection)Activator.CreateInstance(cnType);
cn.ConnectionString = ConfigurationSettings.AppSettings("connectionString");
return cn;

Any application which uses above class must provide following entries in its .config file.

add key="connectionType" value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
add key="connectionString" value="server=your_host;database=your_db;uid=your_uid;pwd=your_pwd" />

This approach is flexible because no recompilation is needed if a new provider is to be utilized.