Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8304471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:51:29+00:00 2026-06-08T17:51:29+00:00

The Problem I have a CakePHP application in which I call a stored procedure:

  • 0

The Problem

I have a CakePHP application in which I call a stored procedure:

$this->FileUpload->query('exec sproc_runjob_ProcessTests', false);

This procedure picks up an uploaded file and processes it. Sometimes people upload multiple files, which calls this once for each file uploaded.

The problem is that I’m getting this error:

Database Error
Error: SQLSTATE[42000]:
    [Microsoft][SQL Server Native Client 11.0][SQL Server]
    SQLServerAgent Error: Request to run job ProcessTests
    (from User [redacted]) refused because the job already has
    a pending request from User [redacted].
SQL Query: exec sproc_runjob_ProcessTests

As far as I can tell, this means that the stored procedure can’t run concurrently – I would have to run the sproc for each process serially, which would be a shame on our fancy new multi-core server.

Solutions we’ve thought of

  1. Run the sproc serially

    Basically the idea here is to call the stored procedure once, then ignore it’s failure if it’s already running. At the end of the sproc call, it would check the database to see if it needs to run again (if there are any "new" files) and run itself again if that is the case.

  2. Don’t use the existing stored procedure

    This would be difficult because of time restrictions, but if someone has a good suggestion for the way we should be doing this, I’d be happy to hear it.

Thanks in advance!

Search results

  1. Looks like this guy has the same problem, and solves it by checking the job status before calling. Perhaps I could do this from PHP before I make the sproc call?

  2. Here’s a mention of something called Service Broker. This might actually be what I’m looking for, but I’d still love any input.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:51:31+00:00Added an answer on June 8, 2026 at 5:51 pm

    From the error message your getting, sounds like your stored procedure is trying to start a SQL job that’s registered in SQL agent. If that’s true, then I would recommend another strategy.

    Ideally, you should pass the file directly to your stored procedure as a binary type, such as image or blob. Let the multithreading of the database handle scaling of concurrent requests. Otherwise, if you try to process the files serially, the application won’t scale well.

    Service Broker is really an endpoint that allows your app to connect to the database in a different way. Yes, you can use it – it would work, but I causation against it.

    Alternatively, you can continue to store files on the filesystem, and the only store the path to your file in the database.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my CakePHP 2 application i have a problem with beforeFilter. In this thread
I have a CakePHP 1.3 application that has a login system, which works well.
I'm sure this sort of problem must be common in cakephp (which I've recently
I have a cakePHP application that is pulling data from two different databases, which
I have problem with cakephp's Session->write method. If I set a value like $_SESSION['..']
I have problem with session in cakephp.I have one file chat.php that is in
I am using CakePHP framework with MySQL database and I have problem in saving
I have the following problem in Cakephp: I maded a CMS to edit the
One thing with which I have long had problems, within the CakePHP framework, is
Problem: Have made a small mail program which works perfectly on my developer pc

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.