Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

automatic mail

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I Want to send automatic mail or sms when any chang is made in mysql data base even no user is login at that time. means itss process run on toncat server how can i do this.???
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you updating your mysql database? You need to have some kind of audit fields in your database table. Whenever a record is updated, you update the audit fields i..e updatedBy , lastUpdated. Now you can have a quartz scheduler which can poll these audit fields and based on the lastUpdatedtime can send out emails to the desired recipients.
 
Saloon Keeper
Posts: 7181
166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How could any changes be made to a DB without any user being logged in?

Audit fields rely on them being used. It's not clear from Anshul's problem description that that would be the case. In fact, it's not clear at all how the DB is used. Given that, I'd say the problem description is too vague to advise on anything.
 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Piyush Mangal wrote:How are you updating your mysql database? You need to have some kind of audit fields in your database table. Whenever a record is updated, you update the audit fields i..e updatedBy , lastUpdated. Now you can have a quartz scheduler which can poll these audit fields and based on the lastUpdatedtime can send out emails to the desired recipients.


It's not clear what the OP really wants here, but it sounds like this is a case where DB triggers might help.

Set up a trigger on each of the relevant tables to respond to the changes you are monitoring for, and let it write an entry to a log table (or file) with the information you want to know about. Then poll this log to get the latest changes. By using triggers, you can distinguish between inserts/updates/deletions, and it means the DB takes care of responding to the initial events which may be on multiple tables, while you only have to look in one place - the log - to see what's changed. This will probably be more efficient than constantly polling your original data tables in case they've changed, especially when nothing is happening on your DB or if your data tables are large.

But be careful with your triggers e.g. don't let your triggers make changes to other tables that have their own triggers, or you'll end up cascading changes around your DB like crazy!
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic