Solved

Kind of crazy file watch mechanism

Posted on 2007-11-24
3
163 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
ID: 20343422
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
ID: 20343446
yeah the problem is that the code will be mysql specific right?
0
 
LVL 11

Accepted Solution

by:
DeepuAbrahamK earned 500 total points
ID: 20343451
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

911 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

16 Experts available now in Live!

Get 1:1 Help Now