user928112
user928112

Reputation: 582

How do I get the data provider for IBM DB2 for iSeries?

I'm trying to connect my .NET application to a DB2 for iSeries database (v7.2) using Entity Framework, but I don't see a corresponding data provider when I try to create a model. See the screenshot below.

Entity Data Model Wizard

I've done some research on this issue and have looked at previously answered questions as well, and I know that I'm supposed to install something to get that data provider showing up, but what exactly am I supposed to be installing? There's NuGet packages available for DB2 that seem to do absolutely nothing, and the one third party provider that I found works only for DB2 Universal, whereas I'm stuck with DB2 for iSeries.

Upvotes: 0

Views: 683

Answers (1)

Steve Py
Steve Py

Reputation: 34783

Chances are you're not going to be able to generate a model using the wizards when connecting with a DB2 database. From what I read, features like code-first isn't supported so I wouldn't hold my breath on any hand-holding by generators/wizards. I also wouldn't count on EF Core support, though others may have relevant experience connecting to DB2 data sources.

This means you will likely need to set up your DbContext and Entity configurations manually. It's not difficult, just a bit of work to provide your DbContext a connection string to the DB2 server, and start by setting up one of the entities as a DbSet to verify that you can connect, read, and write to the database. The usual points to work through would be things like data type mapping and any relationships between tables, then there may be limitations in the provider for how Linq operations are translated when querying entities.

I'd start with: https://www.nuget.org/packages/EntityFramework.IBM.DB2/ and go over the documentation provided here: https://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.swg.im.dbclient.adonet.doc/doc/c0061830.html

From the EF side, familiarize yourself with EntityTypeConfiguration for configuring the entity to the table structure. (Or using the OnModelCreating override on the DbContext.)

Upvotes: 1

Related Questions