IBM Data Studio 无法浏览 SAMPLE (DB2 Express-C) 上的数据
IBM Data Studio can't browse data on SAMPLE (DB2 Express-C)
我无法浏览 SAMPLE DB 上的数据。设置如下:- Windows 7 64 位 PRO,
- IBM DB2 Express-C,10.5.500.107(最新) - IBM Data Studio 版本 4.1.1(管理安装,使用 IBM Installation Manager 1.8.1 安装)
数据库凭据是:db2admin/db2admin Windows 管理员用户名是:Nenad(受密码保护)
使用 DB2 命令行处理器(开始 -> IBM DB2 DB2COPY1(默认) -> DB2 命令行处理器)我可以使用以下方式连接到 SAMPLE 数据库:
db2 => connect to sample
Database Connection Information
Database server = DB2/NT64 10.5.5
SQL authorization ID = NENAD
Local database alias = SAMPLE
并使用以下方式查询员工 table:
db2 => select * from staff
ID NAME DEPT JOB YEARS SALARY COMM
------ --------- ------ ----- ------ --------- ---------
10 Sanders 20 Mgr 7 98357.50 -
20 Pernal 20 Sales 8 78171.25 612.45
30 Marenghi 38 Mgr 5 77506.75 -
40 O'Brien 38 Sales 6 78006.00 846.55
50 Hanes 15 Mgr 10 80659.80 -
60 Quigley 38 Sales - 66808.30 650.25
70 Rothman 15 Sales 7 76502.83 1152.00
80 James 20 Clerk - 43504.60 128.20
90 Koonitz 42 Sales 6 38001.75 1386.70
100 Plotz 42 Mgr 7 78352.80 -
110 Ngan 15 Clerk 5 42508.20 206.60
120 Naughton 38 Clerk - 42954.75 180.00
130 Yamaguchi 42 Clerk 6 40505.90 75.60
140 Fraye 51 Mgr 6 91150.00 -
150 Williams 51 Sales 6 79456.50 637.65
160 Molinare 10 Mgr 7 82959.20 -
170 Kermisch 15 Clerk 4 42258.50 110.10
180 Abrahams 38 Clerk 3 37009.75 236.50
190 Sneider 20 Clerk 8 34252.75 126.50
200 Scoutten 42 Clerk - 41508.60 84.20
210 Lu 10 Mgr 10 90010.00 -
220 Smith 51 Sales 7 87654.50 992.80
230 Lundquist 51 Clerk 3 83369.80 189.65
240 Daniels 10 Mgr 5 79260.25 -
250 Wheeler 51 Clerk 6 74460.00 513.30
260 Jones 10 Mgr 12 81234.00 -
270 Lea 66 Mgr 9 88555.50 -
280 Wilson 66 Sales 9 78674.50 811.50
290 Quill 84 Mgr 10 89818.00 -
300 Davis 84 Sales 5 65454.50 806.10
310 Graham 66 Sales 13 71000.00 200.30
320 Gonzales 66 Sales 4 76858.20 844.00
330 Burke 66 Clerk 1 49988.00 55.50
340 Edwards 84 Sales 7 67844.00 1285.00
350 Gafney 84 Clerk 5 43030.50 188.00
35 record(s) selected.
所以我想 DB/DBMS 工作正常。
然后我使用以下设置在 Data Studio 中创建连接:
Database: SAMPLE
Host: localhost
Port number: 50000
Username: db2admin
Password: db2admin
与测试连接:与Ping成功!结果。
当我点击 Table 时,我可以看到所有这些。
但是当我右键单击 (Schema: NENAD) (Table Name: STAFF) Data -> Browse Data 我得到这个错误:
com.ibm.db2.jcc.am.SqlSyntaxErrorException: 语句失败,因为授权 ID 没有执行操作所需的授权或特权。授权 ID:"DB2ADMIN"。操作:"SELECT"。对象:"NENAD.STAFF"..SQLCODE=-551,SQLSTATE=42501,DRIVER=4.18.60
该语句失败,因为授权 ID 没有执行该操作所需的授权或特权。授权 ID:"DB2ADMIN"。操作:"SELECT"。对象:"NENAD.STAFF"..SQLCODE=-551,SQLSTATE=42501,DRIVER=4.18.60
我尝试使用各种设置和用户名多次重新安装 DB2 和 Data Studio,我尝试右键单击 table 然后管理权限(将所有权限授予 DB2ADMIN 和 NENAD),但没有成功。
我也无法创建新数据库,出现此错误:
创建数据库 FTN 自动存储是 'C:\DB2\NODE0000' DBPATH ON 'C:\DB2\NODE0000' ALIAS FTN WITH 'FTN database'
无法执行命令。 DAS 返回以下错误:sqlcode=-22201 output=null
我的问题是:
- 我该如何解决这个错误?
- 有没有一种简单的方法(就像在 SQL 开发人员中一样)来创建
用户,然后单击授予所有权限,就这样了吗?
使用 Oracle Express DB 和 SQL Studio,我以这种(非常简单的)方式创建新用户并授予权限:
编辑 - 更新:
我不得不使用:
Step 1:
Start menu -> IBM DB2 DB2COPY1 (Default) -> DB2 Command Line Processor
In DB2 Command Line Processor:
db2 => connect to sample
db2 => GRANT DBADM ON DATABASE to db2admin
Step 2:
db2admin stop
db2admin start
之后我可以在 Data Studio 中浏览数据并执行查询,但我仍然无法从 Data Studio 创建新数据库?
这些帖子没有直接关系或没有帮助我解决这个问题:
Cannot connect IBM data studio with DB2 Express-C (Error: User Id Revoked)
DB2 query runs in IBM Data Studio but not in code
IBM Data Studio Connection error SQL1035N
IBM Data Studio
IBM data studio not connecting to local DB2 databases
db2 Express-C SAMPLE database
IBM DB2 created schema is not visible?
IBM Data Studio (Admin client) version 3.1.1
How to create New instance in db2 10.1 using IBM Data Studio
How to create a new schema on a database at IBM Data Studio?
您的问题是您以 Nenad 的身份登录到命令行(您可以通过默认模式来判断),并且以 db2admin 的身份通过 DataStudio 登录到数据库。您需要以 Nenad 身份登录到 Data Studio。或者作为 Nenad,您需要向用户 ID db2admin 授予适当的权限。
EDIT: To add to better explain things as well as your question in the comments below.... DB2 doesn't use created user ids like other
databases do. It looks to the underlying operating system or LDAP for
authentication. In the Unix/Linux environment, the instance Id that is
the highest ID administratively is what ID the instance is set up to
run as. Your db2admin account is this account. That being
said....Windows introduces a different security scheme. Even though
the instance ID exists, whoever installed the product (their user ID)
tends to be granted high administrative powers in DB2. And when you
issue the CREATE DATABASE
statement, you are doing it with your
Windows user ID. Therefore, it becomes the owner of the database and
has DBADM
, SECADM
, DATAACCESS
, and ACCESSCTRL
granted to it.
db2admin will generally have DBADM WITHOUT DATAACCESS WITHOUT
ACCESSCTRL
. So you would need to log in as Nenad (the ID with
SECADM
) and grant (to be safe) DBADM
, SECADM
, DATAACCESS
,
ACCESSCTRL
to user db2admin. Now that ID should have what you are
looking for.
I don't recommend those privileges for just any ID. If all you need is
access to read/write to tables then DATAACCESS
alone should do it.
我在创建新数据库时遇到了同样的问题,我已经通过 运行ning 这个命令解决了:db2set DB2_CREATE_DB_ON_CHANGE=YES
使用 DB2 命令 Window(作为管理员):
(1)停止数据库
(2) 运行 db2set DB2_CREATE_DB_ON_CHANGE=YES
(3)启动数据库
现在您可以通过指定本地存储、数据库名称来使用 Data Studio 创建新数据库......
我无法浏览 SAMPLE DB 上的数据。设置如下:- Windows 7 64 位 PRO, - IBM DB2 Express-C,10.5.500.107(最新) - IBM Data Studio 版本 4.1.1(管理安装,使用 IBM Installation Manager 1.8.1 安装)
数据库凭据是:db2admin/db2admin Windows 管理员用户名是:Nenad(受密码保护)
使用 DB2 命令行处理器(开始 -> IBM DB2 DB2COPY1(默认) -> DB2 命令行处理器)我可以使用以下方式连接到 SAMPLE 数据库:
db2 => connect to sample
Database Connection Information
Database server = DB2/NT64 10.5.5
SQL authorization ID = NENAD
Local database alias = SAMPLE
并使用以下方式查询员工 table:
db2 => select * from staff
ID NAME DEPT JOB YEARS SALARY COMM
------ --------- ------ ----- ------ --------- ---------
10 Sanders 20 Mgr 7 98357.50 -
20 Pernal 20 Sales 8 78171.25 612.45
30 Marenghi 38 Mgr 5 77506.75 -
40 O'Brien 38 Sales 6 78006.00 846.55
50 Hanes 15 Mgr 10 80659.80 -
60 Quigley 38 Sales - 66808.30 650.25
70 Rothman 15 Sales 7 76502.83 1152.00
80 James 20 Clerk - 43504.60 128.20
90 Koonitz 42 Sales 6 38001.75 1386.70
100 Plotz 42 Mgr 7 78352.80 -
110 Ngan 15 Clerk 5 42508.20 206.60
120 Naughton 38 Clerk - 42954.75 180.00
130 Yamaguchi 42 Clerk 6 40505.90 75.60
140 Fraye 51 Mgr 6 91150.00 -
150 Williams 51 Sales 6 79456.50 637.65
160 Molinare 10 Mgr 7 82959.20 -
170 Kermisch 15 Clerk 4 42258.50 110.10
180 Abrahams 38 Clerk 3 37009.75 236.50
190 Sneider 20 Clerk 8 34252.75 126.50
200 Scoutten 42 Clerk - 41508.60 84.20
210 Lu 10 Mgr 10 90010.00 -
220 Smith 51 Sales 7 87654.50 992.80
230 Lundquist 51 Clerk 3 83369.80 189.65
240 Daniels 10 Mgr 5 79260.25 -
250 Wheeler 51 Clerk 6 74460.00 513.30
260 Jones 10 Mgr 12 81234.00 -
270 Lea 66 Mgr 9 88555.50 -
280 Wilson 66 Sales 9 78674.50 811.50
290 Quill 84 Mgr 10 89818.00 -
300 Davis 84 Sales 5 65454.50 806.10
310 Graham 66 Sales 13 71000.00 200.30
320 Gonzales 66 Sales 4 76858.20 844.00
330 Burke 66 Clerk 1 49988.00 55.50
340 Edwards 84 Sales 7 67844.00 1285.00
350 Gafney 84 Clerk 5 43030.50 188.00
35 record(s) selected.
所以我想 DB/DBMS 工作正常。
然后我使用以下设置在 Data Studio 中创建连接:
Database: SAMPLE
Host: localhost
Port number: 50000
Username: db2admin
Password: db2admin
与测试连接:与Ping成功!结果。
当我点击 Table 时,我可以看到所有这些。
但是当我右键单击 (Schema: NENAD) (Table Name: STAFF) Data -> Browse Data 我得到这个错误:
com.ibm.db2.jcc.am.SqlSyntaxErrorException: 语句失败,因为授权 ID 没有执行操作所需的授权或特权。授权 ID:"DB2ADMIN"。操作:"SELECT"。对象:"NENAD.STAFF"..SQLCODE=-551,SQLSTATE=42501,DRIVER=4.18.60 该语句失败,因为授权 ID 没有执行该操作所需的授权或特权。授权 ID:"DB2ADMIN"。操作:"SELECT"。对象:"NENAD.STAFF"..SQLCODE=-551,SQLSTATE=42501,DRIVER=4.18.60
我尝试使用各种设置和用户名多次重新安装 DB2 和 Data Studio,我尝试右键单击 table 然后管理权限(将所有权限授予 DB2ADMIN 和 NENAD),但没有成功。
我也无法创建新数据库,出现此错误:
创建数据库 FTN 自动存储是 'C:\DB2\NODE0000' DBPATH ON 'C:\DB2\NODE0000' ALIAS FTN WITH 'FTN database' 无法执行命令。 DAS 返回以下错误:sqlcode=-22201 output=null
我的问题是:
- 我该如何解决这个错误?
- 有没有一种简单的方法(就像在 SQL 开发人员中一样)来创建 用户,然后单击授予所有权限,就这样了吗?
使用 Oracle Express DB 和 SQL Studio,我以这种(非常简单的)方式创建新用户并授予权限:
编辑 - 更新: 我不得不使用:
Step 1:
Start menu -> IBM DB2 DB2COPY1 (Default) -> DB2 Command Line Processor
In DB2 Command Line Processor:
db2 => connect to sample
db2 => GRANT DBADM ON DATABASE to db2admin
Step 2:
db2admin stop
db2admin start
之后我可以在 Data Studio 中浏览数据并执行查询,但我仍然无法从 Data Studio 创建新数据库?
这些帖子没有直接关系或没有帮助我解决这个问题:
Cannot connect IBM data studio with DB2 Express-C (Error: User Id Revoked)
DB2 query runs in IBM Data Studio but not in code
IBM Data Studio Connection error SQL1035N
IBM Data Studio
IBM data studio not connecting to local DB2 databases
db2 Express-C SAMPLE database
IBM DB2 created schema is not visible?
IBM Data Studio (Admin client) version 3.1.1
How to create New instance in db2 10.1 using IBM Data Studio
How to create a new schema on a database at IBM Data Studio?
您的问题是您以 Nenad 的身份登录到命令行(您可以通过默认模式来判断),并且以 db2admin 的身份通过 DataStudio 登录到数据库。您需要以 Nenad 身份登录到 Data Studio。或者作为 Nenad,您需要向用户 ID db2admin 授予适当的权限。
EDIT: To add to better explain things as well as your question in the comments below.... DB2 doesn't use created user ids like other databases do. It looks to the underlying operating system or LDAP for authentication. In the Unix/Linux environment, the instance Id that is the highest ID administratively is what ID the instance is set up to run as. Your db2admin account is this account. That being said....Windows introduces a different security scheme. Even though the instance ID exists, whoever installed the product (their user ID) tends to be granted high administrative powers in DB2. And when you issue the
CREATE DATABASE
statement, you are doing it with your Windows user ID. Therefore, it becomes the owner of the database and hasDBADM
,SECADM
,DATAACCESS
, andACCESSCTRL
granted to it. db2admin will generally haveDBADM WITHOUT DATAACCESS WITHOUT ACCESSCTRL
. So you would need to log in as Nenad (the ID withSECADM
) and grant (to be safe)DBADM
,SECADM
,DATAACCESS
,ACCESSCTRL
to user db2admin. Now that ID should have what you are looking for.I don't recommend those privileges for just any ID. If all you need is access to read/write to tables then
DATAACCESS
alone should do it.
我在创建新数据库时遇到了同样的问题,我已经通过 运行ning 这个命令解决了:db2set DB2_CREATE_DB_ON_CHANGE=YES 使用 DB2 命令 Window(作为管理员): (1)停止数据库 (2) 运行 db2set DB2_CREATE_DB_ON_CHANGE=YES (3)启动数据库
现在您可以通过指定本地存储、数据库名称来使用 Data Studio 创建新数据库......