简体   繁体   English

为什么 DB2 将连接字符串中的我的 UserId 作为我的表名?

[英]Why does DB2 put my UserId from the connection string as my table name?

I'm trying to us Entity Framework Core to query my DB2 database.我正在尝试使用 Entity Framework Core 来查询我的 DB2 数据库。 Here's how I register it:这是我注册它的方法:

services.AddDbContext<DB2Contexte>(options =>
                options.UseDb2(Configuration.GetConnectionString("DB2"),
                    builder =>
                    {
                        builder.SetServerInfo(IBMDBServerType.AS400, IBMDBServerVersion.AS400_07_01);
                        builder.UseRowNumberForPaging();
                        builder.MaxBatchSize(1);
                    }));

That's the class the is use as a DbSet:这就是 class 用作 DbSet:

在此处输入图像描述

And there's my connection string:还有我的连接字符串:

Server=something;UserID=U_SERVTI;Password=something;Database=something;服务器=某事;用户 ID=U_SERVTI;密码=某事;数据库=某事; LibraryList=something;CurrentFunctionPath=*LIBL库列表=某事;当前函数路径=*LIBL

Than when I try to query the database using simple LINQ:比我尝试使用简单的 LINQ 查询数据库时:

_dbContext.PersonneRessource.FirstOrDefault()

I get this error:我收到此错误:

ERROR [42704] [IBM][AS] SQL0204N "U_SERVTI.DX37PERE" is an undefined name.错误 [42704] [IBM][AS] SQL0204N “U_SERVTI.DX37PERE”是未定义的名称。

Why is the UserId in the name?为什么名称中有 UserId? Shouldn't it just query the table and leave out the UserID?它不应该只查询表并省略用户ID吗?

I use IBM.EntityFrameworkCore-lnx version 3.1.0.500.我使用 IBM.EntityFrameworkCore-lnx 版本 3.1.0.500。

Db2 for IBM i, for historical reasons, supports two naming conventions; Db2 for IBM i,由于历史原因,支持两种命名约定; SYS and SQL. SYS 和 SQL。

By default, external connections will use SQL naming and like the rest of the Db2 family, unqualified table references will be implicitly qualified with the "run-time authorization identifier";默认情况下,外部连接将使用 SQL 命名,就像 Db2 系列的 rest 一样,不合格的表引用将被隐式限定为“运行时授权标识符”; normally the user id used to connect.通常是用于连接的用户 ID。

With SYS naming, unqualified table references are qualified with *LIBL and the library list is used to find the table.使用 SYS 命名,不合格的表引用由 *LIBL 限定,并且库列表用于查找表。

On your connection string, you're going to want to add Naming=SYS (or maybe Naming=*SYS )在您的连接字符串上,您将要添加Naming=SYS (或者可能是Naming=*SYS

Note that SYS vs. SQL naming affects just about every unqualified reference.请注意,SYS 与 SQL 的命名会影响几乎所有不合格的参考。 Be sure to look at the documentation .请务必查看文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将UserId分配给我的子实体会导致sql表中的2n UserId1列 - Assign UserId to my child entity results in a 2n UserId1 column in the sql table 如何从 EF Core 调用 DB2 表值 Function - How to Call DB2 Table Valued Function from EF Core 我的数据库不会更新,我的连接字符串有问题 - My database won't update, something wrong with my connection string 实体框架正在组合我的表名和 Id 名 - Entity Framework is combining my table name and the Id name 修改从Entity Framework Core返回的本地实体后,为什么我的执行消失了? - Why does my execution dissapear after modifying a local entity returned from Entity Framework Core? 如何“更新”生产环境中我的 Web 应用程序的数据库的连接字符串? - How to 'update' the connection string for the Database that my web app on production environment? 我的表中没有属性名称,但出现列名无效错误 - I don't have property name in my table but I am getting invalid column name error 有没有办法从服务中注入数据库连接字符串而不是 EF-Core DbContextPool 的配置 - Is there a way to inject a DB connection string from a service instead of a configuration for EF-Core DbContextPool EF Core 使用 Class 库项目和数据库脚手架从用户密钥中读取连接字符串 - EF Core Reading Connection String From User Secret Using Class Library Project and DB Scaffolding 为什么 Entity Framework Core 试图将我的字符串键转换为整数? - Why is Entity Framework Core trying to Convert my string key to an Integer?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM