0

Working with DB2 and PHP, my ADDs and DROPs take a long time to finish (30 seconds per ADD and DROP). I am curious if there is a way to send my ADDs and DROPs to the database without having PHP wait for a response?

3
  • 2
    use something like this - w3schools.com/ajax/default.asp - to call up scripts asynchronously. Commented Dec 3, 2010 at 16:10
  • @Dai - that would be better posted as an answer. Commented Dec 3, 2010 at 16:14
  • @Dai - I would have probably picked your answer because that is what I was thinking about doing. Commented Dec 6, 2010 at 1:11

3 Answers 3

1

I'm fairly certain that most php db controls don't have async methods (too bad). Presuming that you just need to do DB statements that don't interact with the end user you could use pcntl_fork. If you need something else, a solution like this may be more useful.

Sign up to request clarification or add additional context in comments.

1 Comment

I like that link, but I think you are right... If I'm going to keep this pure PHP, I need to fork it.
0

A simple solution is cron to schedule your tasks

http://articles.sitepoint.com/article/introducing-cron

Schedule all the sql scripts you want to run at a predetermined time.

Comments

0

You could code up a "standalone" php script and fire it off using a "system" call.

You only problem would how to pass the data to the script. I would recommend you create an intermediate "actions" table where you can instert the desired updates and have the batch script read the actions and apply the updates.

If you have DB2 installed you may have MQ installed as well. If you do, you can look at a solution where you push your update requests into an MQ queue and have them actioned by a triggered program.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.