iSeries connection error with IBM DB2 Connector Core

Viewed 427

When we migrated from .NET framework to .NET core, we had to change the format of our iSeries connection string from using Server= to using Data source= and to include port#, but also we had to include Database= because without it the connection string could not be assigned to a connection due to an "Invalid argument" exception. With absolutely anything for a database, we always get a uniform error message:

ERROR [08004] [IBM] SQL30061N  The database alias or database name \"QSYS              \" was not found at the remote node.

(Notice extra spaces in the DB name)

No matter what we supply for a database, the error is always the same. We tried our actual library name similar to app0123 that is reported by DSPLIB or QSYS etc.

We also tried databases reported by DSPRDBDIRE named similarly to IHST0123 but in this case the error was different:

ERROR [42968] [IBM] SQL1598N An attempt to connect to the database server failed because of a licensing problem.

We know that there is no licensing problem with the server because it is our production environment that many applications in Java and C# connect to.

Our usual practice is that if an application App1 connects, it uses app1 user name and app01, app02 etc schemas, app01 being the default one. Therefore, we only ever had the iSeries host name like IHST01 etc in the connection string, and we added user ID and password through the connection string builder.

We are having no issues connecting through .NET core connector to DB2 LUW since database on it is very apparent and unambiguous. Since we never had to specify an iSeries database under .NET framework, it is not clear what it has to be. Does anybody know?

1 Answers

The library (aka schema) name is not the database name.

The *LOCAL entry in DSPRDBDIRE should be your DB name.

A better tool is IBM Access Client Soultions (ACS) "Database -->Schemas" tool which has a UI like so:

IBM ACS Schemas

On the connected server (ut29p63.rch.stglabs.ibm.com), there are (at least) two databases:

  • ut29p63
  • Dbtest

I'm surprised you don't think the DB name was needed for .NET Framework or Java as I've always needed them. If you've only got one database on your IBM i, as is common for smaller boxes, it's possible the DB name matches the system name.

Judging from the license error message, you are getting connected.

However, the .NET Core nuget packages use the IBM Db2 Connect driver. This driver is included for Db2 for LUW, and with an appropriate and optional license allows connecting to IBM Db2 for i or IBM Db2 for z/OS.

In other words, the Db2 Connect driver can always connect to Db2 LUW but you'll have to pay for an enhanced license to connect to IBM i or IBM z/OS. See IBM Db2 Connect License Types You'll need an Enterprise license or an Unlimited Edition for System i.

If you were using Db2 Connect driver for your .NET Framework, the same license will work for .NET Core (assuming the Db2 Connect versions match).

However, if you were using the free ODBC/OLEDB/ADO driver for .NET Framework, then you'll need the Db2 Connect license for .NET Core.

Related