Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2017
    Posts
    2

    Unanswered: Historicization via trigger

    Hello, I have a DB2 database on which I want to make versioning. In the table I want to version, I have an AUTHOR column that allows to know the author of the row.

    It works very well and when I do an update, I have the name of the author.

    On the other hand when I do a delete, my trigger should make an insert in my versioned table with the author of the delete. How can I get this information?

    I know there is a solution in sql-server -> CONTEXT_INFO. Is there an equivalent in DB2 ??

    So I would need a way to create a kind of variable that can be used in my trigger.

  2. #2
    Join Date
    Jul 2016
    Location
    Moscow
    Posts
    294
    Provided Answers: 45
    Hello,

    The USER special register should help you.
    Regards,
    Mark.

  3. #3
    Join Date
    Apr 2012
    Posts
    1,143
    Provided Answers: 27
    Depends on whether the table rows get altered via jdbc coming from a connection-pool (for example from WAS, or similar, that multiplexes real-user connections among a smaller pool of physical-connections that all share a common auth_id). In that case the USER special register may not give what you expect.

  4. #4
    Join Date
    Jun 2017
    Posts
    2
    Actually I use a physical user by application .. What I want to know is the loginName of the user in my application

  5. #5
    Join Date
    May 2010
    Location
    India
    Posts
    90
    Provided Answers: 2
    Use special register CURRENT CLIENT_USERID.

    Link: https://www.ibm.com/support/knowledg....html#r0005868


    You can set the value for CLIENT_USERID using WLM_SET_CLIENT_INFO procedure.

    Link: https://www.ibm.com/support/knowledg.../r0053116.html


    Satya...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •