Global Data Management Forum

Expand all | Collapse all

The latest Db2 .NET Provider packages uploaded NuGet repository

  • 1.  The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Thu August 20, 2020 04:25 AM
    Hi All,
     we are pleased to inform you about uploading of latest Db2 .NET packages to NuGet repository. Complete list of packages we own is available here:

    https://www.nuget.org/profiles/IBMDB2EF

    We are aware of the inconvenience caused due to unavailability of these packages at Nuget. From now on any future version will be directly available at NuGet repository.

    Thanks
    Vishwa

    ------------------------------
    Hosathota Vishwanatha
    ------------------------------

    #DataManagementGlobal
    #DataServerDrivers


  • 2.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Mon August 31, 2020 06:17 AM
    Witch version of Microsoft.Entityframewok.Tools use with this driver to scaffold-dbcontext of existing tables on Informix 12.10 ?!

    ------------------------------
    iliyan iliev
    developer MoI-DCIS
    ------------------------------



  • 3.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Mon August 31, 2020 09:06 AM
    Hi, 
     Thanks for your work. Using these packages to scaffold from existing DB2 database. Dbcontex is missing out all the indexes available in database. Does it require any special configuration or instruction with command?, Or is it some issues with Db2 IBM.Entityframework.Core ?


    ------------------------------
    Utkarsh Rastogi
    ------------------------------



  • 4.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Wed September 02, 2020 05:42 AM

    Hi Utkarsh,

    We've investigated the issue and could figure out Index is not supported via Scaffolding currently using IBM EF Core provider.
    It's there in our future plans.To help us to prioritize, please open a Aha request using the following link:
    https://ibm-data-and-ai.ideas.aha.io/ideas?project=DB2CON

    Thanks,

    Archana



    ------------------------------
    Archana Soni
    ------------------------------



  • 5.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Fri October 09, 2020 11:09 AM
    Edited by System Fri January 20, 2023 04:19 PM
    Hi,

    We ran into a hard blocker. It appears that like this DB2 adapter doesn't support table names that are also Reserved keywords.
    This affects queries against user, group, lock, session and other(?) tables. Given that we use the same table names with SQL Server but haven't observed the same issues, this appears to be a defect with the DB2 EF Core adapter. 
      We already looked into the obvious workaround: Encoding quotes into the table names in the db context.
    something like this:- entity.ToTable(@"""group""", "MYSCHEMA");
    That further breaks Entity Framework in a different way. It tries to use a quotation mark as aliases for affected tables (presumably since it's the first character in the name), resulting in syntactically invalid SQL.
    Fro Example:-
     Select x.FirstName, ".Name from MYSCHEMA.xTable as x
     INNER JOIN MYSCHEMA."group" as "

    Any help around this is sincerely appreciated. Kindly Look into this at earliest!

    Getting error after using qoutes with tables names



    ------------------------------
    Utkarsh Rastogi
    ------------------------------



  • 6.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Mon October 12, 2020 12:05 AM
    Hi Utkarsh,
     we will look into this and let you know if there are possible workarounds or else needs to fix.

    Thanks
    Vishwa


  • 7.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Mon October 12, 2020 05:40 AM

    Hi Utkarsh,

    If you want to enclose object with double quotes Please use Scaffolding with option enableefcasesensitivity=true .
    For Example:

    Scaffold-DbContext "Server=<servername>:<port>;Database=<databasename>;uid=<user>;pwd=<password>;enableefcasesensitivity=true;" IBM.EntityFrameworkCore -OutputDir Models

    Once model is generated try with LINQ query to reproduce it. Do not remove enableefcasesensitivity=true; from connection string in Context class.

    If still problem persist then please share non-confidential sample application and database object schema definitions to reproduce it in our environment.

    Thanks,
    Archana



    ------------------------------
    Archana Soni
    ------------------------------



  • 8.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Thu October 15, 2020 10:02 AM

    Dear Archana,

     

    I was able to get past issue with Reserve words tables names keeping enableefcasesenstivity=true in Db2 Connections string only. I didn't have to Scaffold the entire thing. The Switch actually enforces every object to be wrapped with double quotes. Hence, it did the trick for us.

     

      Thanking with warm heart over the same, I am facing yet another issues  which I think might have to do with adapter only!!

    We are passing paging options as paging object to be implement pagination on the Result Array.

    Hence using Using

      .UseDb2(connectionString, db2 =>

                    {                

                      Sdb2.UseRowNumberForPaging();

                      sql.SetServerInfo(IBMDBServerType.LUW);

                    }); 

    //..>>Where connections string has enableefcasesenstivity=true.

     

    On early encounters to put it in simple words UseRowNumberForPaging() is not covered/supported with  enableefcasesenstivity=true ,  as we get query such as below (note the section not having quotes on where clause):-

     

     

    SELECT "t"."ID", "t"."NAME", "t"."DESCRIPTION", "t"."ID0", "t"."UPDATE_MODE", "t"."UPDATE_TIME", "t"."UPDATE_URL", "t"."ALLOW_DIRECT_LOGIN", "t"."AUTOFEDERATION", "t"."c"

    FROM (

        SELECT "o"."ID", "o"."NAME", "o"."DESCRIPTION", "t"."ID" AS "ID0", "s"."UPDATE_MODE", "s"."UPDATE_TIME", "s"."UPDATE_URL", "s"."ALLOW_DIRECT_LOGIN", "s"."AUTOFEDERATION", COALESCE("o"."TWO_FACTOR_REQUIRED", 0) AS "c", ROW_NUMBER() OVER(ORDER BY "o"."NAME") AS "c0"

        FROM "DB2ADMIN"."ORG_UNIT" AS "o"

        INNER JOIN (

            SELECT "o0"."ID", "o0"."ALLOW_CONCURRENT_SESSIONS", "o0"."DESCRIPTION", "o0"."GUID", "o0"."NAME", "o0"."PARENT_ID", "o0"."ROOT_ORG_ID", "o0"."TWO_FACTOR_REQUIRED", "o0"."UNIT_LEVEL"

            FROM "DB2ADMIN"."ORG_UNIT" AS "o0"

            WHERE "o0"."UNIT_LEVEL" = 1

        ) AS "t" ON "o"."ID" = "t"."PARENT_ID"

        LEFT JOIN "DB2ADMIN"."SAML2_FEDERATION" AS "s" ON "t"."ID" = "s"."ORG_UNIT_ID"

        WHERE "o"."UNIT_LEVEL" = 0

        ORDER BY "o"."NAME"

    ) AS "t"

    WHERE (t.c0 > 0) AND (t.c0 <= (0 + 10))

     

    Kindly note the where clause which there because of paging support without breaking app.

     

    I did a fine amount of digging around this but not getting anything relevant. Request you to kindly address this as well asap in priority!

     

     

    Thanks & Regards

     

     

     

     

     

     

     






  • 9.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Fri October 16, 2020 06:17 AM
    Hi Utkarsh,

    Glad to hear that Reserve word issue is resolved!!
    For the new issue, Please reach out to IBM Support team using the following url:
    https://www.ibm.com/mysupport/s/?language=en_US

    Thanks,
    Archana

    ------------------------------
    Archana Soni
    ------------------------------



  • 10.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Wed October 21, 2020 08:19 AM

    Hi,

     We need to use DB2 sequences for default value generation for certain key columns (non-identity with with not null constraint).
    For instance:

    entity.Property(e => e.Id)
    .HasColumnName("ID")
    .HasColumnType("integer(4)")
    .ValueGeneratedOnAdd();
     

    None of below sequnce registration are working as expected:

    modelBuilder.Entity<EntityName>().Property(e => e.Id).ForDb2UseSequenceHiLo("SEQUENCE_NAME", "SCHEMA");
    Or

    modelBuilder.Entity<EntityName>().Property(a => a.Id).UseHiLo("SEQUENCE_NAME", "SCHEMA");

      We are getting errors such as below as we get default (0) inplace of id for every transaction on :

    INSERT INTO <SCHEMA>.<ENTITYNAME>(ID, ACTION_NAME, ACTION_TIME, ADMIN_ID, ORG_UNIT_ID, SEVERITY, SOURCE_ADDRESS, STATUS, TARGET)

    ERROR [23505] [IBM][DB2/NT64] SQL0803N One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "1" constrains table "SCHEMA.EntityName" from having duplicate values for the index key. SQLSTATE=23505

     Does anyone has any idea around what we are doing wrong? This is a blocker for us wasting all what we have done so for with IBM driver for DB2.

     Note: The Id column is Non-Identity

    Thanks & Regards,
    Utkarsh Rastogi





    ------------------------------
    Utkarsh Rastogi
    ------------------------------



  • 11.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Fri October 23, 2020 06:38 AM
    Thanks Utkarsh for reaching out to us!!
    Please contact IBM Support team using the following url:
    https://www.ibm.com/mysupport/s/?language=en_US



    ------------------------------
    Archana Soni
    ------------------------------



  • 12.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Fri October 16, 2020 01:32 AM

    Hi Archana,

      Please mark correction int last conversation!

      I missed it as it was text and not through editor.

    Correction:
    Using

      .UseDb2(connectionString, db2 =>

                    {                

                      db2.UseRowNumberForPaging();

                      db2.SetServerInfo(IBMDBServerType.LUW);

                    }); 

    //..>>Where connections string has enableefcasesenstivity=true

     

    The issues is that entire ef core SQL query translation (as mentioned earlier) holds right with double quoting tables and column names/aliases except for the where clause section (only for the one appended due to paging ) and that's where it breaks on DB2 database server.

     

    Regards,

    Utkarsh

     






  • 13.  RE: The latest Db2 .NET Provider packages uploaded NuGet repository

    Posted Mon August 31, 2020 09:08 AM
    Hi Vishwas,
      I have the latest IBM.Entiframework nuget Packages. We are trying to add Db2 support to an existing EFCore app. Have added a project to Reverse Engineer Database and scaffold out models and Dbcontex from a DB2 database.

    ------------------------------
    Utkarsh Rastogi
    ------------------------------