SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server] Timeout error

Hope someone could help me or something, because this is a horror.

I have a connection to an API, in order to make purchases, but that does not matter so much.

Sometimes, we get this error:

resulted in a 500 Internal Server Error response:
“SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Timeout for the wait operation

I think this problem is form the API but I’m not 100% sure about that.

When that happens other operations with different “shops” (providers) and also the same one works well.

So for instance if I sell 1 thing that handle right maybe one fails and none more does.

I think it’s due their problem because they’re having connection problems, but I don’t know if there’s a way to log that error better.

    try {
            $order->addDebugInfo(sprintf("Purchased: %s", date('Y-m-d H:i:s')));
            $ticketsData = $this->get(EntradasService::class)->purchaseSeat(
        } catch(Exception $ex){
            $this->get('logger')->error("PurchaseSeat Error ".$ex->getMessage());
            $order->setErrorMsg("Purchase Error ".$ex->getMessage());
            $bill = $this->get('order.bill')->createBill($order);//create bill
            $this->get('logger')->info("TPVCallback OK", ['id' => $order->getId()]);
            return new Response(sprintf("Error  %d",$order->getId()), 500);

That’s the Try Catch I use for it.

I’m using symfony 3.2, and mysql for db. Doctrine into symfony.

Hope someone could help me.

I would like that code, also with the catch instead of sending me that timeout error, to send something like TPVCallback KO or similar but when I change the Error handling it throws me error.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *