I want to connect to a DB2 database on an IBM i 7.2 server from a Windows client machine using .NET Core 3.1. I installed IBM.Data.DB2.Core via NuGet, but it always throws this cryptic exception:
IBM.Data.DB2.Core.DB2Exception
HResult=0x80004005
Message=External component has thrown an exception.
Source=IBM.Data.DB2.Core
StackTrace:
at IBM.Data.DB2.Core.DB2ConnPool.Open(DB2Connection connection, String& szConnectionString, DB2ConnSettings& ppSettings, Object& ppConn)
at IBM.Data.DB2.Core.DB2Connection.Open()
at Dapper.SqlMapper.<QueryImpl>d__140`1.MoveNext() in /_/Dapper/SqlMapper.cs:line 1079
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 721
at Dapper.SqlMapper.Query(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 648
at SqlPerformanceTesting.Program.<Main>d__0.MoveNext() in C:\Users\mmarchese\Desktop\SqlPerformanceTesting\SqlPerformanceTesting\Program.cs:line 54
I think I need to install different drivers/software on my Windows client machine first. Right now, I have "IBM I Access Client Solutions" installed, but maybe I need something else instead such as "IBM Data Server Drivers?" And that requires a license, it seems? Do I also need to install something on the IBM server to go with it? Can someone spell it out for me or point me to a good guide? I haven't been able to find much myself. Like, "Here are the general steps:"
- Install software A on Windows client
- Install software B on IBM i server
- Install IBM.Data.DB2.Core on Windows client
- Do procedure C to configure Windows client
- Do procedure D to configure IBM server
Update:
If I specify a bad connection string, I get a different error. Since IBM.Data.DB2.Core includes a class for building valid connection strings, I assume my connection string is ok:
var connStringBld = new DB2ConnectionStringBuilder()
{
Database = "myDb",
UserID = "myUser",
Password = "myPassword",
Server = "myIp"
};
Console.WriteLine(connStringBld.ConnectionString);
// Database=myDb;User ID=myUser;Password=myPassword;Server=myIp