Trigger an Light Bulb or Siren based on an update on SQL database

Started by dilip, April 09, 2008, 04:13:10 PM

Previous topic - Next topic

dilip

Hello,
  Is there a way to trigger a light bulb based on a SQL database update. I work for a Sales company and I manage a  SQL database
to store Sales information.As soon as we sell equipment and the invoice gets inserted/updated on the database. I would like to
trigger an ActivePro object that could light up the a bulb whenever the database gets inserted/updated with a new sale. 
The reason to do this is to indicate visually/audio the sales people in the floor that a sale has been made.

Thanks
Dilip

-Bill- (of wgjohns.com)

Quote from: dilip on April 09, 2008, 04:13:10 PM
Hello,
  Is there a way to trigger a light bulb based on a SQL database update. I work for a Sales company and I manage a  SQL database
to store Sales information.As soon as we sell equipment and the invoice gets inserted/updated on the database. I would like to
trigger an ActivePro object that could light up the a bulb whenever the database gets inserted/updated with a new sale. 
The reason to do this is to indicate visually/audio the sales people in the floor that a sale has been made.

Thanks
Dilip

The main issue is, how to know the database has been updated with a sale.

Do you have access to the code that writes to the database?

If not, I have no idea how you would get the trigger in the first place.

Thoughts?
-Bill- (of wgjohns.com)
bill@wgjohns.com

In the real world, the only constant is change.

When I'm online you can find me in the Home Automation Chat Room!

doum

What type of SQL Database?

If MSSQL, you can easily write an After Update Trigger that will send the command with ahcmd or launch an EXE that you developed with the SDK.

rossopoulosg

Hi,
From my (short) experience, AH does not allow any interaction with external events...
I was looking for the "smart" macros to allow checking of simple things like, a file being present
or containing a value... nothing! The "flags" are purely internal.

Now for the database change, I guess, depending on the DB you use,
you should be able to fire triggers that could call the buggy "ahcmd"
and switch a light / siren or anything else... but that's for the upper market DBs...
I'm not sure MySQL has triggers... SQL Server / Oracle have these features.

Otherwise, as Bill mentionned, you can use ahcmd in your code before the db update,
but that's only if you have access to the code...

Cheers

EL34

You don't do it from AH, you do it with the SDK and whatever language you use.
In VB you can access databases and have events triggered as doum said.
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

SMF spam blocked by CleanTalk