Search code examples
c#.netdb2ado.net.net-7.0

DbProviderFactories.RegisterFactory parameters for Net.IBM.Data.Db2 for .NET 7.0


Previously, for .NET Framework 4.8 I was able to use (something like) the following to register the IBM iSeries factory:

DbProviderFactories.RegisterFactory("IBM.Data.DB2.iSeries", "IBM.Data.DB2.iSeries.iDB2Factory, IBM.Data.DB2.iSeries, Version=12.0.0.0, Culture=neutral, PublicKeyToken=9cdb2ebfb1f93a26");

I understand that to connect using .NET 7.0 I now need to use the Net.IBM.Data.Db2 drivers.

What would be the equivalent parameter values for DbProviderFactories.RegisterFactory() for Net.IBM.Data.Db2? I can't seem to find it online.

I have installed the Net.IBM.Data.Db2 NuGet package.


Solution

  • I can actually use this call instead:

    using IBM.Data.Db2;
    DbProviderFactories.RegisterFactory("Net.IBM.Data.DB2", DB2Factory.Instance);
    

    Note that if I then use:

    DataTable dt = DbProviderFactories.GetFactoryClasses();
    

    the data table will show the correct parameter value I was looking for:

    "IBM.Data.Db2.DB2Factory, IBM.Data.Db2, Version=7.0.0.200, Culture=neutral, PublicKeyToken=7c307b91aa13d208"