I'm trying to connect to a db2 instance using EF6 and the new IBM Entity Framework data provider found here
have added the provider to the app config:
<providers> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> <provider invariantName="IBM.Data.DB2" type="IBM.Data.DB2.EntityFramework.DB2ProviderServices, IBM.Data.DB2.EntityFramework, Version=10.5.5.6, Culture=neutral, PublicKeyToken=7c307b91aa13d208" /> </providers>
and connection string looks like so:
<add name="DB2" connectionString="Server=blah;Database=meh;Uid=user;Pwd=pword;" providerName="IBM.Data.DB2" />
I can instantiate a context but when I try to run a query it throws a
Attempt by method 'IBM.Data.DB2.EntityFramework.DB2ProviderServices.GetDbProviderManifestToken(System.Data.Common.DbConnection)' to access method 'IBM.Data.DB2.DB2Trace.Entity_CheckDB2Trace()' failed.
I have installed the DB2 Version 10.5 Fix Pack 5
Any ideas as to what I might be doing wrong?
Turns out I had installed the 10.5.5 driver but it failed to be set as the default. After running the "Default DB2 and Database Client Interface Selection wizard" (found just by searching in the start menu) and setting the new one as the default it worked fine
@Ramu, I have recently started migrating one of our legacy applications and started figuring out how to connect to IBM DB2 using Entity Framework 6. To answer straight to your question - its not possible to work in VS 2015 as IBM database add-ins are supported only until VS 2013. We have contacted IBM and they have no idea if they are going to release these add-ins for VS 2015.
As a work around I built my repository in VS 2013 and made it as a nuget package. I have imported that package into my VS 2015 project. Now packages are much cleaner way of doing it than giving hard dll references.
This is how I setup the environment
Go to programs and features - and always make sure both IBM Data server client and IBM Database add-ins for VS should have same version, release and fix-pack level.
Hope this helps.