DB2 - Read Priviliges cannot read

若如初见. 提交于 2019-12-13 05:50:32

问题


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\')

This returned among others, READTABLE.

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

[DB2/AIX64] SQL0204N "ACCOUNTX.READTABLE is an undefined name. SQLSTATE=42704

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


回答1:


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.

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).

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.



来源:https://stackoverflow.com/questions/31727655/db2-read-priviliges-cannot-read

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!