Search code examples
loggingtriggersdb2audit-logging

How to audit a trigger on DB2?


My question is very simple, i'm working with WebSphere Commerce and DB2 , i have my own trigger on db2 . I need to see on a log file when the trigger starts and when the trigger ends . Which log file have this information on DB2?

Grettings from Peru!


Solution

  • Triggers are not executed separately from SQL statements that fire them; they are actually compiled in to the statement that causes the trigger to fire.

    If you need to know when triggers are firing you'll need to make the trigger perform the logging actions you require. Keep in mind that triggers occur within the transaction scope, so any changes your trigger makes (e.g., inserting into a log table) will be rolled back with the rest of the transaction.

    For auditing purposes you would need to handle this logging via an autonomous procedure (which occurs outside of the scope of the rest of the transaction).