+ Reply to Thread
Results 1 to 2 of 2

Special register USER

  1. Special register USER

    Is there is a way in DB2 to update user id Special register USER ?
    Thank's in advance.

    --
    Message posted via DBMonster.com
    http://www.dbmonster.com/Uwe/Forums....m-db2/200807/1


  2. Re: Special register USER

    lenygold via DBMonster.com wrote:

    > Is there is a way in DB2 to update user id Special register USER ?
    > Thank's in advance.


    Indeed - log in as a different user ;-)

    However, if you're looking for a way to "impersonate" another user -
    you can do this on DB2 9 and above, but only with certain privileges.
    First, someone with SECADM authority has to grant your user
    SETSESSIONUSER privilege [1] on the user ID you wish to impersonate.
    Then, when you logon you simply use SET SESSION_USER [2]:

    CONNECT TO SAMPLE USER DB2ADMIN;
    GRANT SETSESSIONUSER ON USER FRED TO USER BARNEY;
    CONNECT RESET;

    CONNECT TO SAMPLE USER BARNEY;
    SET SESSION_USER FRED;

    If Barney now does something like "VALUES USER;" he should see:

    1
    -----------
    FRED


    [1]
    http://publib.boulder.ibm.com/infoce.../com.ibm.db2.l
    uw.sql.ref.doc/doc/r0020073.html

    [2]
    http://publib.boulder.ibm.com/infoce.../com.ibm.db2.l
    uw.sql.ref.doc/doc/r0011139.html


    Cheers,

    Dave.

+ Reply to Thread