Solved

Kind of crazy file watch mechanism

Posted on 2007-11-24
3
162 Views
Last Modified: 2010-04-01
Hi,

This is kind of crazy and was looking for advice. I have a mysql database. Some external process may write a record to my table, which should start a new process. Something like:

    1) Mysql database is created
    2) Some external process creates a new record in the table with data 192.168.1.2, "hello"
    3) I want a local process to be created now and send data "hello" to 192.168.1.2

I was hoping to use triggers but you can't start processes with them, and besides i think the code is specific to mysql. I'm using an odbc lib so was hoping to make this generic so any db could work in place of mysql.

The only generic solution I can come up with is having a process that just polls the table of interest every 10 seconds and handles any new records it finds. I hate polling but I don't know a better way to handle this. Anyone have any better ideas?

Thanks
0
Comment
Question by:DJ_AM_Juicebox
  • 2
3 Comments
 
LVL 11

Expert Comment

by:DeepuAbrahamK
Comment Utility
You can use triggers, well, user defined functions can be invoked by a trigger
http://dev.mysql.com/doc/mysql/en/adding-functions.html

Best Regards,
DeepuAbrahamK
0
 

Author Comment

by:DJ_AM_Juicebox
Comment Utility
yeah the problem is that the code will be mysql specific right?
0
 
LVL 11

Accepted Solution

by:
DeepuAbrahamK earned 500 total points
Comment Utility
Yeah when you go for trigger it will be specific to the DB. Polling DB is not that efficent way of doing it. But you can check the db in a fixed interval of time.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now