Search code examples
c#db2asp.net-core-webapiasp.net-core-6.0

Connecting to IBM AS/400 with OS/400 data queue from a C# ASP.NET Core 6 Web API


I am very confused trying to connect to a data queue to an AS/400 running OS/400 from a C# ASP.NET Core 6 Web API. I am not sure what package I could use. Net.IBM.Data.Db2 does not explicitly say it supports OS/400. Are there some nuget packages I could use?


Solution

  • IBM offers two different providers for .net to work with i-series Db2-databases (i.e as400 databases)

    Choose the right one for your needs.

    The providers are:

    (1) Net.IBM.Data.Db2, it is available as a nuget (in addition to installation of a suitable IBM Data Server driver), and it requires a Db2-connect-personal-edition (separate purchase) to be applied ( a file in a specific subdirectory) otherwise a connection attempt to i-series (or z/os) will throw an exception. Connections to Db2-LUW do not need a licence. This is in fact a thin layer around IBM's clidriver which is a tiny odbc driver that works with all Db2-server flavours, and it works with multiple programming-languages (not only .net, but also PHP, Perl, C/C++, R, Go, etc...)

    (2) IBM.Data.DB2.iseries - is not currently available as a nuget. It becomes available after you download and successfully install two separate components from IBM (see below).

    How to choose which provider to use?

    Use (1) when your code will need to run against any or all Db2-server flavours ( i-series, or z/os, or Db2-on-cloud, or on premises Db-2LUW) or against suitably configured Informix environments. This driver is suitably generic but is not tightly integrated with other (non-DB2) aspects of i-series functionality.

    Use (2) when your code only needs to work with i-series Db2, and never with z/os databases or Linux/Unix/Windows databases or z/Linux databases or Informix databases. This driver is best for tight i-series integration and interoperability with all of the services available via the IBM i access solution. This provider is preferred for those who are already comfortable with i-series and the i-series access client solution functionality.

    Get (1) either via nuget, or via download/install an IBM Data Server Driver appropriate to you operating system/environment/chipset. Documentation of the Net.IBM.Data.Db2 namespace contents is via the main Db2 Knowledge Centre online website , and it is not specific to i-series but very much biaised towards Db2-Linux/Unix/Windows server platforms although the ADO.NET interface is constant, the differences relating to i-series specific connection keywords, statement-keywords, and i-series specific query-syntax (if you use any). For any Db2-server-side query documentation please use the i-series knowledge centre instead of the Db2-LUW Knowledge Centre pages.

    Get (2) via download and install of two components (IBM registration + IBM login required , and acceptance of IBM license terms first), via https://www.ibm.com/support/pages/ibm-i-access-client-solutions ( click the Downloads...) link. After you enter your IBM login credentials and confirm licensing agreement, you will see several packages. You need to download and install "IBM i Access Client Solutions" first, and then download and install the second component "ACS Windows App Pkg English (64-bit)" (when your target workstation runs Microsoft Windows, although a linux x64 and Macos app-package is also available). The Windows App package has an installshield installer that lets you use a custom install to choose which functions you need. Some functionality requires a license, so read the docs carefully. After you install this Windows App package, there will be an icon on your desktop in which you will find links to documentation (which is installed locally in CHM file format) including the programmer toolkit which includes namespace and assembly and config file details for using it, along with the details of the namespace contents.