Sam
Sam

Reputation: 1525

Connect to DB2 using EF6

I have a WPF app using EF6 and I need to connect to a DB2 database.

I have my data layer in a separate library from the main app. My connection string in the App.config looks like so:

<connectionStrings>
    <add name="TIMSContext" connectionString="Database=DB2C;UID=blah;PWD=blahblah;Server=myServer:446;" providerName="IBM.Data.DB2" />
  </connectionStrings>

I have a reference to the IBM DB2 EntityFramework package in my data library.

When I try to run, I get an error saying that the provider cannot be found.

If I try to include a reference to the IBM EF package in the main app, I get a type initializer error at startup.

Upvotes: 3

Views: 765

Answers (2)

Sam
Sam

Reputation: 1525

Apparently DB2 has issues with EF6... I backed down to EF5 and it all worked fine.

Upvotes: 0

Riegardt Steyn
Riegardt Steyn

Reputation: 5701

I do not think this is possible. You need a license for DB2 Connect aside from your company's iSeries license (someone please correct me if I'm wrong; I would be very happy to hear of an alternative).

As such, we are forced to continue using MyGeneration dOOdads at my company, which has not been supported for almost a decade. -.-

See this SO answer for more; I don't think anything has changed since then...

Upvotes: 1

Related Questions