DB2 database and User Privileges
Join the DZone community and get the full member experience.Join For Free
IBM DB2 is a family of database server products developed by IBM. Here I was connecting DB2 and WSO2 products. Here I will show how to create users and grant privileges for DB2 users.
Here I have two users. One is 'madhuka' and and second user is 'db2test1'. Madhuka has all the rights (admin). db2test1 is a standard user. I have db2 database called 'regdb7'.
Here I am try to connect to regdb7 from user 'db2test1'.
db2test1 user does not have privilege to connect to regdb7.
Now user 'madhuka' (admin) connects to db and gives privileges to db2test1 user.
db2 => connect to regdb7 user madhuka using <password>
Here pass user grants
Now try connect from db2test1
Yap, you are in.
You can revoke the permission from
db2=> REVOKE CONNECT ON DATABASE FROM USER db2test1
Here we try it out:
Here is full use case that we try:
Here is privilege list to try:
Published at DZone with permission of Madhuka Udantha, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.