Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes Invoke Java program on DB Update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Invoke Java program on DB Update" Watch "Invoke Java program on DB Update" New topic
Author

Invoke Java program on DB Update

Mrutyunjay Hanchinal
Ranch Hand

Joined: Sep 26, 2001
Posts: 50
Hi
How or Is it possible to invoke a Java routine whenever a database gets updated?
Thanks in anticipation
Mrutyunjay
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

You would have to create a trigger, that calls a stored procedure that calls a java program(can do this from oracle, don't know about other DB's). It would probably be better to just create a trigger to do the work if at all possible.
Jamie
Craig Demyanovich
Ranch Hand

Joined: Sep 25, 2000
Posts: 173
In a project on which I'm working, we have the concept of change awareness (CA). For DBs that support triggers, we have triggered CA. A trigger is fired on insert/update/delete, and it places some information about the change in a change log table, housed in the same DB. We also have a program the polls the change log on a regular basis. If entries exist in the change log when it's polled, all entries are extracted, loaded into a java.util.List of Data Transfer Objects, and the list is passed to another component for processing.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

I just stumbled across the info that you may need while doing some of my own research on a different topic:
http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83728/04jserv2.htm#1006439 describes how to call a java stored procedure from a trigger which is invoked on an insert, update or whatever you specify... but again, it is for Oracle.
Jamie
Mrutyunjay Hanchinal
Ranch Hand

Joined: Sep 26, 2001
Posts: 50
Hi
Thanks for the info.
Regards
Mrutyunjay
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invoke Java program on DB Update
 
Similar Threads
Polymorphism and Instance Variables?
Running an app in background?
webservices swings
how to invoke jvm fro c++
about ADO