Unable to find the requested .Net Framework Data Provider. It may not be installed

Hi guys, I was on my holidays and enjoying something different so I was away for some time. However right now I am back and working on a Sliver light project. In that project I found an interesting situation which I would like to share with you. I was using Enterprise Library 5.0 for my connection string and I was using Oracle.DataAccess for my connection.

Here was the line on which I was getting error:-
dbase = DatabaseFactory.CreateDatabase("MyDB");


After spending some time I checked that every thing seems OK and there is no issue with my web.config file. I tried to replace CreateDatabase and use another way to create database connection in Enterprise Library:-
DbProviderFactory providerFactory =
DbProviderFactories.GetFactory("Oracle.DataAccess.Client");
dbase = new Microsoft.Practices.EnterpriseLibrary.Data
.GenericDatabase("data source=xxx;User id=xxx;Password=xxx;",providerFactory);

Above also did not solved my problem and I started to get another error :-

I checked that either I have installed ODP or not but It was installed in my GAC folder (usually at C:\Windows\assembly). Here is how my GAC folder looks like:-

Now finally I had a clue that what happened. My system have multiple versions of Oracle.DataAccess installed and .net can not decide that which version should be used. So, to Resolve this I have to add a DbProviderFactory in my web.config file. So here is how I added it:-
 <system.data>
    <DbProviderFactories>
    <add name="Oracle Data Provider for .NET"
            invariant="Oracle.DataAccess.Client"
            description="Oracle Data Provider for .NET"
            type="Oracle.DataAccess.Client.OracleClientFactory,
                  Oracle.DataAccess,
                  Version=2.112.1.2,
                  Culture=neutral,
                  PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>

Now last thing, I know that I have to use Oracle.DataAccess but how did I get other information i.e. Version, Culture and PublicKeyToken. To do this simply right click on the Assembly and take it properties. Here is the page that will appear through which you can get all the details:-

Finally my application started working and it connected to database perfectly. Hopefully this will also be useful for you . Do share your comments with me. Happy coding !!!



8 comments:

  1. An outstanding ѕhare! I've just forwarded this onto a friend who was doing a little homework on this. And he actually bought me breakfast because I found it for him... lol. So let me reword this.... Thanks for the meal!! But yeah, thanx for spending time to talk about this topic here on your internet site.

    My homepage: payday loans

    ReplyDelete
  2. This information is priceless. When can I find out more?


    My web page :: damp cigaret

    ReplyDelete
  3. Hi, I think your website might be having browser compatibility issues.
    When I look at your blog in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping.

    I just wanted to give you a quick heads up! Other then that, very good blog!


    Feel free to visit my web page; ryge væsker

    ReplyDelete
  4. Attraсtive sеctiοn of content. I juѕt stumbled upon уour site and in accession capital to asѕert that I acquiгe in fact enjoyed acсount youг blog posts.
    Anywaу I'll be subscribing to your augment and even I achievement you access consistently quickly.

    My web site ... payday loans

    ReplyDelete
  5. Thanks for another magnificent post. Where else may anybody get that type of information in such an ideal way of writing?
    I have a presentation next week, and I'm at the look for such info.

    Here is my web blog airplane game

    ReplyDelete
  6. Ι used to bе аble to fіnd gоοԁ info from уour content.


    my blοg рoѕt: Same Day Payday Loans

    ReplyDelete
  7. I used to be suggested this website through my cousin.
    I am now not sure whether this put up is written through him
    as no one else recognise such detailed about my trouble.
    You are incredible! Thanks!

    Here is my blog: elektrisk cigaret ()

    ReplyDelete
  8. Howdy! I know this is kinda off topic but I was wondering if you knew where I could locate a
    captcha plugin for my comment form? I'm using the same blog platform as yours and I'm having difficulty
    finding one? Thanks a lot!

    Have a look at my blog post ... e-cigaretter

    ReplyDelete