db2top -u and db2top -p

Today’s topic is the -u option and its partner, the -p option. You’ll see how they can be combined with the -n option when you need db2top to connect with a user ID and password.

The -u and -p options are meant to be used together. The -u option takes one argument, the user name, and the -p option takes one argument, the password. Failure to specify the argument for either results in the usual error message about the missing argument.

If you remember from an earlier blog posting, the -n argument lets you specify the node name, which is useful in certain circumstances. The -u and -p options are only useful in combination with the -n option. Otherwise, they are ignored. As long as you did not specify a -n option, you could specify an invalid user to -u and/or an invalid password to -p and db2top would still load correctly. Here is an example of what happens if you specify the -n option and specify an invalid user to the -u option:

db2top -n node1 -u baduser -p badpass

*** Attaching to node1

SQL30082N  Security processing failed with reason "24" ("USERNAME AND/OR
PASSWORD INVALID").  SQLSTATE=08001

Exiting...

If you specify a value for the -u option without specifying the -p option, you get prompted to enter the password before db2top will start. This prompt does not echo the characters you type.

When you create a .db2toprc file using db2top (a topic for another day), the database, node name, and user, among other things, are saved to the file. The password you specified when prompted or via the -p option is also written to the .db2toprc file, except that it is encrypted.