java DB2:授予 db2admin 对 localhost 数据库的所有权限
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17674685/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
DB2 : Grant all privileges to db2admin on the localhost database
提问by Sonam Daultani
I have installed DB2 Express-C on my local machine and sample database is created for my username. Now, I want db2admin to access this sample database. I have tried below command,
我已经在本地机器上安装了 DB2 Express-C,并为我的用户名创建了示例数据库。现在,我想让 db2admin 访问这个示例数据库。我试过下面的命令,
connect to DATABASENAME user USER_NAME using USER_PASSWORD
GRANT DBADM,CREATETAB,BINDADD,CONNECT,CREATE_NOT_FENCED_ROUTINE,IMPLICIT_SCHEMA,LOAD,CREATE_EXTERNAL_ROUTINE,QUIESCE_CONNECT,SECADM ON DATABASE TO USER DB2ADMIN;
But then too, I am unable to access the database tables using db2admin as shown below,
但是,我也无法使用 db2admin 访问数据库表,如下所示,
connect to DATABASENAME user db2admin using USER_PASSWORD
list tables
It is displaying 0 record found. That means it is not able to access the database.
它显示找到 0 条记录。这意味着它无法访问数据库。
Any help would be highly appreciated.
任何帮助将不胜感激。
回答by Ingo
That means it is not able to access the database.
这意味着它无法访问数据库。
Wrong. DB2 would tell you that already when you connected. Your example merely shows that user db2admin has no tables in his default schema.
错误的。DB2 会在您连接时告诉您。您的示例仅显示用户 db2admin 在其默认模式中没有表。
Try this:
试试这个:
list tables for schema user_name
where user_name
is the name of the db creator.
user_name
数据库创建者的名字在哪里。
Note that
注意
list tables
lists the tables for the current user, and will return 0 rows until you create some.
列出当前用户的表,并将返回 0 行,直到您创建一些。
回答by xxks-kkk
I think you can try the following steps: (Here I'll use SAMPLE as an example)
我认为您可以尝试以下步骤:(这里以SAMPLE为例)
connect to SAMPLE using your windows domain ID:
db2 connect to SAMPLE
Here, the connection will use your windows domain ID by default. And you check this by return "SQL authorization ID = "
db2 grant DATAACCESS on DATABASE to user db2admin
This will grant
DATAACCESS
authority todb2admin
Terminate connection:
db2 terminate
Connect to SAMPLE with db2admin:
db2 connect to sample user db2admin using 'password'
You should be able to access db with your
db2admin
使用您的 Windows 域 ID 连接到 SAMPLE:
db2 connect to SAMPLE
在这里,默认情况下连接将使用您的 Windows 域 ID。然后你通过返回“SQL授权ID =”来检查这个
db2 grant DATAACCESS on DATABASE to user db2admin
这将授予
DATAACCESS
权限db2admin
终止连接:
db2 terminate
使用 db2admin 连接到 SAMPLE:
db2 connect to sample user db2admin using 'password'
您应该可以使用您的数据库访问数据库
db2admin
You can read more about windows domain ID and db2admin here:
您可以在此处阅读有关 Windows 域 ID 和 db2admin 的更多信息:
- IBM Data Studio can't browse data on SAMPLE (DB2 Express-C)
- How do I grant all privileges to local db2admin with DB2 9.7 on Windows?
Please let me know how it works.
请让我知道它是如何工作的。