I got this problem... and I dunno which forum to put it in.
i got a Java application which will update data in a certain database table. Now when this table is updated, an external application should be called, which will pick up this data and send it to MQ.
I need to know, how can i trigger this event to pick up the data from the database table, whenever an update is fired on the table from my Java appliation. I am using WSAD 5.1 as my developer. My application is deployed on WAS 5.1 on a Linux box. The database server is DB2. I use Websphere MQ 5.1 for my queues.
So, in effect you are asking how to configure DB2 to run a trigger when a record in a certain table is updated. The fact that it's JDBC that is doing the updating is irrelevant. This is a question about DB2. (Unless, perhaps, you only want the trigger to be called when your Java program does the updating. In which case you should just have the Java program do the updating and send the message to MQ, and forget about triggers.)
Here's the first entry returned from my internet query about "DB2 trigger":
It doesn't show how to send data to MQ in that article, but I would assume the DB2 help system would have plenty of information. In my experience IBM products always have large volumes of help text available.
Is it possible for the Java app doing the DB update to then send a JMS message (containing the PK) for a message listener to process? I'd prefer this solution as it doesn't tie you into a particular DB.
That's how I read the question, too. You can even put the database update and the send in the same transaction so if the send fails the database update rolls back. If that's what you want. [ December 25, 2005: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: May 05, 2005
Thanks for all the help guys... There are a few more points...
1. In my application say 'A1', the user will fire a request to send data to MQ. There is a possibility the user will log out after that.
2. Now, the amount of data that needs to be processed and sent to MQ is very large and this might take a few hours. So, this processing of data and sending to MQ needs to be done on a seperate application, which cannot be run on the same server on which my application A1 is running(to avoid overloading the server).
3. My concern here is, how will I invoke this seperate(Send to MQ) application from my application A1 whenever the user would want to trigger sending data to MQ from the application A1.
Joined: Jan 29, 2003
Answered on the other thread.
subject: Fire a trigger from an external application on database update