Please login or register.

Login with username, password and session length

Author Topic: Trigger an Light Bulb or Siren based on an update on SQL database  (Read 8412 times)

dilip

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 1

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
« Last Edit: April 09, 2008, 09:25:59 PM by dilip »
Logged

-Bill- (of wgjohns.com)

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 81
  • Posts: 1340
  • He's just this guy. You know?
    • wgjohns.com
Re: Trigger an Light Bulb or Siren based on an update on SQL database
« Reply #1 on: April 09, 2008, 10:11:05 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?
Logged
-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

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 1
Re: Trigger an Light Bulb or Siren based on an update on SQL database
« Reply #2 on: April 10, 2008, 12:04:33 PM »

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.
Logged

rossopoulosg

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 2
Re: Trigger an Light Bulb or Siren based on an update on SQL database
« Reply #3 on: April 10, 2008, 12:05:39 PM »

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
Logged

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Trigger an Light Bulb or Siren based on an update on SQL database
« Reply #4 on: April 10, 2008, 01:00:17 PM »

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.
Logged
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
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.