• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Fire a trigger from an external application on database update

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 27451
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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":

http://www-128.ibm.com/developerworks/db2/library/techarticle/0308bhogal/0308bhogal.html

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.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Pratik Lohia
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Answered on the other thread.
 
Hold that thought. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic