0

I use a kind of snippet code like this

foreach($contacts as $contact){
    $db_stmt = $this->db->prepare("EXECUTE stpFoo '', '', ?, ?");

    //... operation code

}

When I arrive around 700 contacts, the $db_stmt is null. I suppose my Sql Server database is busy, and I guess i should raise the timeout for connection. I'm asking if somebody already has this error to look for the best solution.

Did not find it in the stack heap...

Thanks for reading ;).

Ps: it is not a duplicate, as the database is sql-server and I already put

$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

The error is displayed below.

fxlacroix
  • 557
  • 4
  • 18
  • Herer is the error : `A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond` So it failed after a certain number of success with a static expression – fxlacroix Oct 23 '17 at 13:08
  • I alos have this error:`TCP Provider: An existing connection was forcibly closed by the remote host` – fxlacroix Oct 23 '17 at 13:13
  • 1
    You should be preparing once outside the loop, and execute multiple times inside it. Prepare does not execute. – miken32 Oct 24 '17 at 20:03
  • nice tip, I will try, but it looks like one break in timeout... i will give you feedback about that – fxlacroix Oct 25 '17 at 10:00

0 Answers0