How to setup IBM DB2 9.7 to work with Entity Framework 6 and Visual Studio 2015?

1.7k views Asked by At

I'm using Visual Studio 2015 to develop an ASP.NET MVC application on a Windows 7, 64-bit machine and I want to connect to an IBM DB2 9.7 database using Entity Framework 6 (Code-First).

Background

I've found a number of articles online that indicate that the IBM Data Server Driver package and the IBM Visual Studio Add-In are required in order to use DB2 with Entity Framework 6 (although most of the articles appear to be referencing DB2 version 10.5). I have installed the IBM Data Server Driver package 32-bit and 64-bit versions, and the IBM Visual Studio Add-In (only 32-bit appears to be available), but a DB2 provider does not appear when I attempt to create the ADO.NET Entity Framework Code-First connection.

Visual Studio 2015 Entity Framework Data Source

Install Files

I installed the following files in the order listed:

  1. IBM Data Server Driver Package - Windows 32bit
  2. IBM Data Server Driver Package - Windows 64bit
  3. IBM Data Server Driver for ODBC and CLI (32-bit) - Windows 32bit
  4. IBM Data Server Driver for ODBC and CLI (64-bit) - Windows 64bit
  5. IBM Database Add-Ins for Visual Studio - Windows 32bit

Process

After installing the IBM Data Server Driver package, I opened the Default DB2 and Database Client Interface Selection Wizard app for my DB2 client install and set the default configuration to the Default IBM database client interface (ODBC/CLI driver and .NET data provider) copy.

Then, I extracted the zip file for the 32-bit and 64-bit versions of the IBM Data Server Driver for ODBC and CLI to the IBM folder in the C:\Program Files\ and C:\Program Files (x86)\ directories. I opened an elevated command prompt, navigated to the bin folder inside the extracted clidriver folders, and ran the following command:

db2cli install -setup

Finally, I installed the IBM Visual Studio Add-In. After installing it, I opened a new MVC project in Visual Studio 2015 and installed the Entity Framework 6 provider for DB2 using Nuget. Then I right-clicked on Models and clicked Add | New Item | Data | ADO.NET Entity Data Model | Add. In the subsequent window, I clicked on Code First from database. In the next window, I clicked New Connection. This is where I arrived at the screen shot I provided above.

For reference, I tried a number of different permutations of the above steps without any luck.

Questions

  1. The documentation for IBM Fix Pack 11 indicates that it works with my database version (9.7.09)...is the documentation wrong?
  2. Am I missing a step that's preventing the provider from appearing in the list?
  3. Does the IBM Visual Studio Add-In not work with Visual Studio 2015 despite the articles I've found that suggest otherwise?
  4. Is the fact that I have a DB2 client installed part of the problem? (I don't really want to uninstall it if it isn't)

Reference Articles

  1. Windows 10 and Visual Studio 2015 Support
  2. IBM Driver not recognized as supporting Entity Framework 6
  3. Installing IBM data server clients and drivers (Windows)
  4. Getting Started with IBM Entity Framework 6 Database First using MVC 5 (LUW,IDS,zOS and IBM i Servers) on Windows 10
  5. DB2 ODBC CLI driver Download and Installation information
  6. VS 2015 support announcement
  7. Accesses DB2 with entity framework 6 on visual studio 2015
  8. Working with Entity Framework 6.0 ON IBM Informix V11.10+ in Visual Studio 2015
  9. Code-Based Configuration of EF6 Provider for IBM Data Servers (DB2 for i, z/OS, LUW and IDS) in ASP .NET 5 Applications

Thanks.

1

There are 1 answers

1
Subbu On

We use IBM i Access Client Solutions to get the .Net DB2 provider.

Unfortunately, this is not freely downloadable.

IBM i Access Client Solutions

https://www-03.ibm.com/systems/power/software/i/access/solutions.html

IBM i Access Client Solutions - Windows Application Package for Windows operating systems.

Features include:

Connectivity to DB2 for i using ODBC, .Net, and OLE DB

Programming Toolkit for accessing IBM i system objects

Support for TLS/SSL connections

AFP printer driver

IBM DB2 .Net provider