Automatically notifying C++ application of database table updates

Automatically notifying C++ application of database table updates

I have a C++ application that interacts with an Oracle database. I want my application to be notified if any changes occur in a table (value changes for a field). So, I thought about triggers. But, the question is how do I transfer these value changes from the Oracle database to my application?

    Requires Free Membership to View

    By submitting your registration information to SearchOracle.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchOracle.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

A database trigger won't automatically contact your application for you. But there are some ways to work around the problem. You could have a trigger that would populate a table with some relevant information. This new table could even contain a time stamp of the action that caused the table to be populated. You could then have your application poll this table looking for new changes to process.

The other way to work around this is to use a trigger to populate Oracle's Advanced Queueing tables, or message queues. The trigger could leave a message in the queue. Your application could periodically check for new messages and act accordingly.

The first solution is the easiest. The second solution is the most elegant, but takes the most time to implement.


This was first published in September 2004

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.