Over a million developers have joined DZone.

DB2 database and User Privileges

· Database Zone

Build fast, scale big with MongoDB Atlas, a hosted service for the leading NoSQL database. Try it now! Brought to you in partnership with MongoDB.

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


Now it's easier than ever to get started with MongoDB, the database that allows startups and enterprises alike to rapidly build planet-scale apps. Introducing MongoDB Atlas, the official hosted service for the database on AWS. Try it now! Brought to you in partnership with MongoDB.

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 best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

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

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

{{ parent.tldr }}

{{ parent.urlSource.name }}