本文介绍了DB2-读取特权无法读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用帐户(ACCOUNTX)从某个表(READTABLE)中读取。该帐户对表READTABLE具有读取(选择)特权。我使用以下方法进行了检查:

I'm trying to read from a certain table (READTABLE) using an account (ACCOUNTX). This account has read (select) privileges on table, READTABLE. I checked this using:

from syscat.tabauth
where grantee = CURRENT USER and (SELECTAUTH = \'Y\' OR SELECTAUTH = \'G\')

除其他外,这返回为READTABLE。

This returned among others, READTABLE.

但是,执行其中我具有 FROM READTABLE 的语句时,出现以下错误:

However, executing a statement in which I have FROM READTABLE I get the following error:

[DB2 / AIX64] SQL0204N ACCOUNTX.READTABLE是未定义的名称。SQLSTATE = 42704

为什么此表预先添加了ACCOUNTX?或者我的特权检查查询不正确?

Why does this table get ACCOUNTX pre-pended to it? Or is my privilege-check query wrong?

推荐答案

DB2中的每个表都属于一个模式,因此,一个完全限定的表名由模式名和表名组成,并用点分隔。

Each table in DB2 belongs to a schema. Therefore, a fully qualified table name consists of both the schema name and the table name, separated by a dot.

,在引用表时,您没有明确地用模式名称来限定它,DB2将采用会话中设置的 CURRENT SCHEMA 变量的值。缺省情况下,当前模式是初始的

If, when referencing a table, you do not qualify it with a schema name explicitly, DB2 will take the value of the CURRENT SCHEMA variable set in your session. By default CURRENT SCHEMA is initialized with the value of your authorization ID (username).

显然,您的表 READTABLE 属于不同的架构来自 ACCOUNTX 。如果您没有读取表的权限,则错误将有所不同。

Apparently, your table READTABLE belongs to a schema different from ACCOUNTX. If you don't have permissions to read the table, the error will be different.

这篇关于DB2-读取特权无法读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 13:13