Hello, I'm fairly new to the DB2 world. Here's my problem, I'm replicating data from a laptop running DB2 PE 8.1.5 to a server running DB2 UDB 8.1. The target table has an insert trigger defined on it, but it doesn't appear to fire when data is replicated in.
If I run an insert stmt on the target directly, the trigger fires. If I run the same insert stmt on the source, then replicate the data over, the data is inserted at the target, but the trigger does not fire.
Are there any limitations or gotchas with triggers and replication?
Here is the trigger if it makes a difference:
CREATE TRIGGER SIDS.GI_TRIGG_INS
NO CASCADE BEFORE INSERT ON SIDS.GI_GEN_INFO
REFERENCING NEW AS inserted
FOR EACH ROW
SET inserted.TESTFIELD = 'BLAAAAA';
Thanks for the reply Tony. I haven't tried setting up an event monitor yet, although it sounds like a good suggestion.
I didn't actually set up the replication, but here's my understanding of it. There are many sources (laptops) and a single target (central server). Technically the replication is bidirectional, but it is filtered so each laptop only has it's own set of data that it initially inserted. The replication is transactional.
So, I want to insert a record on a laptop, have it replicate to the central server. When it is inserted on the central server, I want a trigger there to fire and update some state information. The central server contains the 'master' copy of the data.
After much testing, I think I have discovered the problem.
The table I'm inserting into has both an INSERT and an UPDATE trigger defined on it at the target.
From the source, if I just perform an insert, then replicate it, the INSERT trigger on my target table fires.
If I do an insert, followed by an update at the source, then force replication, the INSERT trigger at my target does not fire, only the UPDATE trigger fires.
This doesn not seem like what the correct behavior should be, but that is what I am observing.
There is a setting under replicate to condense changes so your update is sufficient to replicate the insert. Can't remember the field but you can ask replication to replay all transactions to get a complete history. The condense option is obviously there to give replication better performance.
Though in the back of my mind I can't help but feel you need at least one insert to happen otherwise your row will never exist to update.