DB2 – How to Add a User with a Password

db2

I'm struggling here on how to do this I couldn't find anywhere or won't be able understand the documentation.

So I'm connected as a DBA user on a DB2 client (TOAD for example) and I want to create a new user to the database from this client, I went to the User tab, right click on it and chose the Add User option.

There is no place to add the user password. Even confirming the create command the user appears on the users list.

So I went to the command line tool and try to create a new using the GRANT command as:

GRANT DBADM WITH DATAACCESS WITH ACCESSCTRL ON DATABASE TO USER TEST;

The user gets created (I see it on the user tab on TOAD) but I'm unable to connect with it because I didn't define the password.

So, how can I define a password for newly created user on DB2 that it is not an OS user?

Best Answer

There are no users in DB2 that are not OS users. The client software (not only Toad is guilty of this) makes this a bit confusing: what they show as "users" are actually grants given to the (externally defined) users.

As you have discovered, you can grant privileges to arbitrary users or groups, and no verification is done if those users and groups exist at that time.

However, to connect to the database and exercise the granted privileges you must authenticate first, and for that you must have the user defined in the OS (or another configured authentication service, such as an LDAP directory).