10.7. Windows Domain Considerations
In almost all production environments, database administrators group users together and grant certain privileges or database authorities to those groups. As you can imagine, this is more efficient than maintaining privileges for each individual user. Given that DB2 does not maintain any user and group authentication information, it is important to understand how the groups are being looked up for the users. Windows domain environments in particular have different types of user groups that warrant some discussion.
10.7.1. Windows Global Groups and Local Groups
For example, a DB2 server is defined on the Windows domain MMDOM, and within the domain, a domain controller is a server that maintains a master database of all the domain users' credentials. It is also used to authenticate domain logons. In Figure 10.37 you can see that a user ID db2admin is a member of global group MMDBA in the domain MMDOM. To use global groups, you must include them inside a local group on the DB2 server. When DB2 enumerates all the groups that a person is a member of, it also lists the local groups the user is a member of indirectly. Permission to access the database and/or object must be granted to this local group.
Figure 10.37. Support of global groups in DB2

Figure 10.38. Support of LOCAL or DOMAIN group lookup
[View full size image]

Note that the fully qualified authentication ID also works in GRANT and REVOKE statements. For example:
CONNECT TO sample USER mmdba/db2admin USING password
Alternatively, use the DB2 registry variable DB2_GRP_LOOKUP to tell DB2 where to validate user accounts and perform group member lookup. Set the variable to LOCAL to force DB2 to always enumerate groups and validate user accounts locally on the DB2 server. Set the variable to DOMAIN to force DB2 to always enumerate groups and validate user accounts on the Windows domain to which the user account belongs. For example:
GRANT SELECT ON TABLE employee TO USER mmdba/db2admin
db2set DB2_GRP_LOOKUP = DOMAIN
10.7.2. Access Tokens |
| DB2_GRP_LOOKUP Setting | Description |
|---|---|
| TOKEN | Enables access token support to look up all groups that the user belongs to at the location where the user account is defined. |
| LOCAL, TOKENLOCAL | Enables access token support to look up local groups or to fallback to use LOCAL group lookup if an access token is not available. |
| DOMAIN, TOKENDOMAIN | Enables access token support to look up domain groups or to fallback to DOMAIN group lookup if an access token is not available. |
