[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I refresh mysql queries every X-minutes.

Posted on 2009-04-21
7
Medium Priority
?
380 Views
Last Modified: 2013-12-12
I am using php to refresh oracle data to a mysql database, that part is fairly smooth.  I need a way to run this code every 15 minutes.  I do not have to have the refresh run on a website, and would prefer to do this through an application (ex. Java).  Does anyone know the best way, or best programming language to do the following that could be automated?

Currently I  query an Oracle database, send info to Mysql database (currently using php via an intranet website to send to txt file, then using DATA FILE  INLOAD to write to mysql.  
0
Comment
Question by:qbonep
  • 3
  • 2
  • 2
7 Comments
 
LVL 12

Accepted Solution

by:
Richard Davis earned 1600 total points
ID: 24201153
If you're running on a Unix server...just create a cron job that fires every 15 minutes and calls a PHP script at the time it fires.

If you're running windows...set up a Scheduled Task in the control panel that does the same thing.

Always check that your permissions are okay in either case and since you're executing something that does not need to be ran from a UI...then just store that file outside of public web space and security shouldn't be of too great of a concern.

Hope this helped. :)

~A~
0
 
LVL 14

Assisted Solution

by:shobinsun
shobinsun earned 400 total points
ID: 24202017
Hi,

try with this :

At the end of your page, add:

<script language="javascript">
window.setTimeout("self.location.href='<?=$PHP_SELF ?>'", 60000);
</script>  

(For one minute)


Hope this will help you.

Regards
0
 

Author Comment

by:qbonep
ID: 24204310
Ok, that should be fine to run in a webpage, but these queries may take up to 5 minutes to refresh.   I would rather get away from a webpage if possible.  Is there another way to go about this?  I think the possibility of a webpage crashing out is too unreliable.  Is it even possible to use another application to refresh the oracle query and dump to mysql?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:Richard Davis
ID: 24210205
qbonep, my comment was a server-side solution that will run 24/7 and does not require running out of a web page. Did you not understand my suggestion, perhaps?

~A~
0
 

Author Comment

by:qbonep
ID: 24228266
ok.  sorry it took so long to get back.  So run the cron job using php....  I'll give that a try.  Do you have any good links as an example?
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24231100
0
 
LVL 12

Expert Comment

by:Richard Davis
ID: 24234569
What shobinson sent you would be a great example. I would highly recommend the first link. It actually shows using a PHP script as the target of a scheduled task via the cron system.

~A~
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month20 days, 6 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question