Global Data Management Forum

Data Management Global

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

 View Only
  • 1.  EntityFrameworkCore 7 - context.saveChanges - userid instead of schema is getting added to insert record to DB2 table

    Posted 08/03/23 04:14 PM

    I am using IBM.EntityFrameworkCore to communicate with DB2. Facing the an issue while context.saveChanges.

    The framework is adding logged in userid as the schema name as the prefix to the table when trying to insert a record into the DB2 table.

    Actual Error Message: ERROR [42704] [IBM][DB2] SQL0204N  "<userid>.<tablename>" is an undefined name.

    This is happening while inserting a record into a table which has an Identity Column.

    Any help is appreciated.

    Thanks in Advance.



    ------------------------------
    Kishan Devunoori
    ------------------------------


  • 2.  RE: EntityFrameworkCore 7 - context.saveChanges - userid instead of schema is getting added to insert record to DB2 table

    Posted 08/03/23 08:54 PM

    This is likely a configuration or mapping issue.



    ------------------------------
    Youssef Sbai Idrissi
    Software Engineer
    ------------------------------



  • 3.  RE: EntityFrameworkCore 7 - context.saveChanges - userid instead of schema is getting added to insert record to DB2 table

    Posted 08/04/23 08:03 AM

    scaffolded from DB2 and use the same entities in the project. For all select and get Linq queries, the framework is adding the schema name. But it is adding the logged in userid as the schema to while inserting (adding) a new entity to the table.

    If we assign the Identity column value to the entity, the framework adds the schema name to the table when context.savechanges called.

    But we dont want to assign the identity column value to the entity as it should be generated by the database. In this case, the framework is adding the userid as schema to the table.

     



    ------------------------------
    Kishan Devunoori
    ------------------------------



  • 4.  RE: EntityFrameworkCore 7 - context.saveChanges - userid instead of schema is getting added to insert record to DB2 table

    Posted 09/27/23 11:02 AM

    Were you able to find a solution here?  For us it seems like it uses userid and not schema when  the insert includes an identity column on the table.  The insert seems to work fine when there is not an identity column on the table.



    ------------------------------
    Chad Breiner
    ------------------------------