Data Management Global

Data Management Global

A hub for collaboration, learning, networking, and cultural exchange, and contributing to positive global engagement

 View Only

How to provide IBM Data Server Connection Information via IBM Data Server provider for EF Core 1.1.1

By Michelle Betbadal posted Wed April 29, 2020 03:40 PM

  

IBM Entity Framework Core Provider mandates the user to provide server platform type, and version in addition to the connection string while configuring DbContext. To pass server information, User can use SetServerInfo(..) method which belongs to the namespace IBM.EntityFrameworkCore.Storage.Internal.

For example:

OptionBuilder.UseDb2(<Connection String>, p=>p.SetServerInfo( <Platform Type>, <Server Version> ));

To connect to a DB2 for zOS Data Server, it would look like:

using IBM.EntityFrameworkCore;

using IBM.EntityFrameworkCore.Storage.Internal;

...

…

namespace MyCoreConsoleApp.Model

{

      public partial class MyContext : DbContext

      {

        …

             protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

            {

                optionsBuilder.UseDb2(<Connection String>,

                   p=>p.SetServerInfo(IBMDBServerType.OS390, IBMDBServerVersion.OS390_11_01 ));

            }

       …

      }

}

The second argument (server version) of SetServerInfo(...) method is optional. If it is not specified, the latest supported version for the respective Database server will be taken as the default. Please refer the following table for detailed information about platform type and server version for the currently supported IBM Data Servers:

S.No. Description Platform Type Server Version
1. Db2 for zOS IBMDBServerType.OS390
  • IBMDBServerVersion.OS390_10_01
  • IBMDBServerVersion.OS390_11_01
2. IBM i IBMDBServerType.AS400
  • IBMDBServerVersion.AS400_07_01

  • IBMDBServerVersion.AS400_07_02

3. Db2 for LUW IBMDBServerType.LUW
  • IBMDBServerVersion.LUW_10_05_08

  • IBMDBServerVersion.LUW_11_01_1010

  • IBMDBServerVersion.LUW_11_01_2020

4. Informix Database Server IBMDBServerType.IDS
  • IBMDBServerVersion.IDS_11_70_7300

  • IBMDBServerVersion.IDS_11_70_8000

  • IBMDBServerVersion.IDS_12_10_2000


Note: In the above table, Highlighted Server Version is taken as default, if not specified by user.


#DataManagementGlobal
#DataServerDrivers
1 comment
29 views

Permalink

Comments

Mon May 12, 2025 10:09 AM

Hi: Michelle Betbadal

I am doing the same exercise connecting to an as400, but I have a novelty, it always takes 17 seconds to connect at the beginning but in the second connection it takes less than 1 second, what can it be?