Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

DB2 database and User Privileges

DZone's Guide to

DB2 database and User Privileges

· Database Zone
Free Resource

Learn how to move from MongoDB to Couchbase Server for consistent high performance in distributed environments at any scale.

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

image

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>

image

Here pass user grants

image

Then quit

Now try connect from db2test1

image

Yap, you are in.

You can revoke the permission from

db2=> REVOKE CONNECT ON DATABASE FROM USER db2test1

Here we try it out:

image

Here is full use case that we try:

image

Here is privilege list to try:

[1] http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.sec.doc%2Fdoc%2Fc0005478.html


Want to deliver a whole new level of customer experience? Learn how to make your move from MongoDB to Couchbase Server.

Topics:

Published at DZone with permission of Madhuka Udantha, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}