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).
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.
I installed the following files in the order listed:
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.
We use IBM i Access Client Solutions to get the .Net DB2 provider.
Unfortunately, this is not freely downloadable.
IBM i Access Client Solutions
IBM i Access Client Solutions - Windows Application Package for Windows operating systems.
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