Question & Answer
How to change DB2 user password?
User IDs and passwords for DB2 are managed at OS level. However, passwords can also be changed when connecting to databases. For example, use the CONNECT statement to change the password as the following,
db2 "CONNECT TO <database> USER <userid> USING <password> NEW <new_password> CONFIRM <new_password>"
For JDBC, there's a method for DB2Connection interface, changeDB2Password.
For CLI, change password with the CLI function SQLDriverConnect. This can be done with the Interactive CLI Sample Program which can be brought up by running "db2cli" command. For example, run the following with db2cli interface,
> opt calldiag on
> sqlallocconnect 1 1
> sqldriverconnect 1 0 "database=<dbname>;hostname=<hostname>;port=<port>;protocol=tcpip;uid=<uid>;pwd=<oldpwd>;newpwd=<newpwd>" -3 512 SQL_DRIVER_NOPROMPT
16 June 2018