How to execute a query interval of 1 month in mysql [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am developing an application using servlet and jdbc using mysql database.
Here I have to move one table data into other table in every month end(lets say 30th)
visitorlog
id name date
1 XYZ 02-10-2016
visitorloghistory
id name date
Here I have to move all data of visitorlog into visitorloghistory in each month end, and need to remove data from visitorlog.
I have no idea how to do this.
Thanks in advance.

This is called event scheduler or more specifically cron job. The following should help you to start:
https://www.sitepoint.com/how-to-create-mysql-events/
http://www.mysqltutorial.org/mysql-triggers/working-mysql-scheduled-event/
The event schedulers are set to perform specific tasks depending upon time. The following is a sample:
DELIMITER ;;
CREATE EVENT UpdateData ON SCHEDULE EVERY DAY STARTS '2016-10-10 00:00:00' -- This is scheduled to start from '2016-10-10' and updates data every day
DO BEGIN
UPDATE table1 SET Status = 1 WHERE Status = 0;
UPDATE table2 SET Status = 1 WHERE Status = 0;
END;;
DELIMITER ;

Your can check this out. Write a script which will run at particular time.
Cron job for a Java Program

Related

Implementing countdown timer that works with firebase [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a problem that I'm stuck at, I'm trying to create a countdown timer that update itself from firebase, the timer will be shown to all users whenever a user visit my app ( I am creating a school management application,I want the timer the countdown timer to look like this 12days: 32 min : 3second to exams and let it automatically refresh so that it get new content).
I think the easiest way to do this is to create a deadline date value and store that date value in a firebase databse. When the user opens the app, you fetch the deadline value from firebase and then start a count down timer in the local app.
To get the deadline value from firebase you can use this link.
To create a count down timer you can use this link.
What you can do instead of changing the timer from Firebase is to save a timestamp into Firebase (the date you are planning to countdown from) and then query it client side and do the calculations of the days from the client.

How to run scheduled task in AWS? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a school application. Where the teacher can send mail to each parent. Parent has to check email and confirm (reply) back in 2 days .
If the parent does not respond back we automatically need to send out second followup email.
Parent response will be parsed in Lambda and same will be updated in database. so that we should not send followup email .
I am using Amazon SES for sending the email.
How can implement wait for 2 days logic ? should I use lambda function or JScheduler ?
How can implement wait for 2 days logic ?
You may use AWS Step functions which is statefull state-machine workflow. The service implements a wait task you may use to way for 2 days

If I have multiple updates and inserts on multiple tables written one below the other in SQL, how do I optimise the code? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Code structure:
Public void Function() throws ioexcption
Update table a set values
Update table b set values
Insert into c values
Insert into d values
Many more updates and inserts
Function ends
How do I optimise the code? As the current code few minutes to complete when thousands of records are there. Will stored procedures help or will indexing help?
Write all the changes in a file, read the file, parse every line, create a prepared statement, populate the parameters and execute it.

How to print a file on a scheduled date? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am working on printing a file with scheduled date (selected a date from datepicker) in Java, but I don't have any idea about how to do it.
Use cron based tasks that will fire and do the work. For your case, you may use Quartz
It's depend on what actualy you do.
If you want to print many files in different time (printer queque in some oraginsation for example) you could follow next recomendation:
1) place all records about planned print in some storage (file, DB)
2) create one scheduler( #Scheduled in spring for example, or java sheduled executor) wich will processed queqe every minute(if minute is minmal interval of date that you could select).
(Be careful and select delay option instead of rate in your scheduler)
3) print only whose files that time to proceed.

Start a minute counter for every newly added item [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am developing a website where the users will add items they want to sell.
I am now trying to figure out a way how to place a munite counter for every newly added item. I need the counter to start from 0 and count every minute the item has been active. I also need the counter to reset at the end of every month and start again from 0 in the beginning of the next month.
Do you have any suggestions where I can start from?
I will appreciate any help here.
Thanks a lot!
If I were you I would store the creation date inside a database and derive the number of minutes it has been available from it. If you're going to store a counter in memory things won't scale, apart from the fact that in case of failure you would lose all information.

Categories