0

I would like to connect to Db2 database with user "appuser1" and then switching session user to "user1".

In Db2 v11.5.7 on Linux I connected to server using SSH.

I connected to database with Db2 super-user and created trusted context:

CREATE TRUSTED CONTEXT tc1 BASED UPON CONNECTION
USING SYSTEM AUTHID appuser1
ENABLE
ATTRIBUTES (ADDRESS '192.168.100.10')
WITH USE FOR realuser WITHOUT AUTHENTICATION"

I connected to database with my appuser1:

CONNECT TO db1 USER appuser1 USING password

Now, how to switch user to "user1" from db2cmd to test switching user?

1 Answer 1

1

You cannot switch the user via the CLI, but only programmatically.

1
  • Thanks. It looks like Trusted Context is not really useful in our case because we need "switching user" functionality for all kind of Db2 clients including db2cmd. Probably better way is to use "set session_user". The downside is, there is no authentication for "switched user" in "set session_user" functionality.
    – folow
    Jul 14, 2022 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.