I am encountering a timeout error when attempting to connect to SQL Server using Doctrine DBAL with the ODBC Driver 17 for SQL Server in my Laravel application. Here’s the error log:
{
"logtime": "2024-12-20 15:47:26.360",
"message": "SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: The wait operation timed out.",
"context": {
"exception": {
"class": "Doctrine\DBAL\Driver\PDO\Exception",
"message": "SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: The wait operation timed out.",
"code": 8001,
"file": "C:\inetpub\wwwroot\SFI.BE\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDO\Exception.php:18",
"previous": {
"class": "PDOException",
"message": "SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: The wait operation timed out.",
"code": 8001,
"file": "C:\inetpub\wwwroot\SFI.BE\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:40"
}
}
},
"level": 400,
"level_name": "ERROR",
"channel": "local",
"datetime": {
"date": "2024-12-20 15:47:26.360454",
"timezone_type": 3,
"timezone": "Asia/Jakarta"
},
"extra": {
"ip": "791-VM-2342",
"ipserver": "791-VM-2342"
}
}
Environtmen:
-
Laravel Framework
-
Doctrine DBAL
-
Microsoft ODBC Driver 17 for SQL Server
-
SQL Server 2019
-
Running on Windows Server
It’s happen in my production server
Steps Taken:
-
Verified that the SQL Server is up and running.
-
Tested the connection using SSMS (SQL Server Management Studio) — the connection works fine.
-
Ensured the
ODBC Driver 17
is installed on the server. -
Verified the firewall rules and ensured the correct ports (1433) are open.
Questions:
-
What could cause the “TCP Provider: The wait operation timed out” error in this context?
-
Are there specific configurations in Doctrine DBAL or Laravel’s database config that I should check to prevent this issue?
-
Could this be related to SQL Server or network settings? If so, how can I troubleshoot further?
3