IBM DB2 is a family of database server products developed by IBM. Here I was connecting DB2 and WSO2 products. Here I am show creating user and granting privilages for DB2 user.
Here I have two user one is 'madhuka' and and second user is 'db2test1'. Madhuka have all the right (admin). db2test1 is standard user. I have db2 database called 'regdb7'
Here I am try to connect to regdb7 from user 'db2test1'
db2 => connect to regdb7 user db2test1
Enter current password for db2test1:
SQL1060N User "DB2TEST1" does not have the CONNECT privilege. SQLSTATE=08004
db2test1 user do not have privilege to connect to regdb7
Now user 'madhuka' (admin) connect to db and give priviladges to db2test1 user
db2 => connect to regdb7 user madhuka using <password>
Database Connection Information
Database server = DB2/NT64 10.5.1
SQL authorization ID = MADHUKA
Local database alias = REGDB7
Here pass user grants
db2 => GRANT CONNECT ON DATABASE TO USER db2test1
DB20000I The SQL command completed successfully.
then quit
now try connect from db2test1
db2 => connect to regdb7 user db2test1
Enter current password for db2test1:
Database Connection Information
Database server = DB2/NT64 10.5.1
SQL authorization ID = DB2TEST1
Local database alias = REGDB7
Yap, you are in
You can revoke the permission from
db2=> REVOKE CONNECT ON DATABASE FROM USER db2test1
Here is we try out
Here is full use case that we try
Here is privilege list to try
No comments:
Post a Comment