[英]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.