Java Reminder Scheduler

617 views Asked by At

How to make my java class to continuously read the database in a loop and then send reminders through java mail if there is an entry in the database.

For example, I have a table called "jobs" which has the columns job_id, epoch_time, email_id. Here when the epoch_time equals current time, I have to send mail to email_id.

Thanks in advance.

2

There are 2 answers

1
Shree Naath On

You can use trigger to call a JAVA program you want. Say, you can call a program in AFTER INSERT or BEFORE INSERT. Refer https://docs.oracle.com/database/122/JJDEV/calling-Java-from-database-triggers.htm#JJDEV13286. Hope this suits your scenario.

0
Gautam Chakraborty On
  1. You Can do it with extending TimerTask to your class. For example Read More about Java TimerTask
  2. Another option is Using Java Timer. Using scheduling method you can schedule your specific task. Example with Java Timer