Closed aelliott1485 closed 1 year ago
Do you have a small repro script? Like a .php file that tries to connect? I want to to see exactly how he timeout value is set.
I can attempt to create a script with the docker container used. Until then, below is the sanitized DSN, config and options used in Illuminate\Database\Connectors\SqlServerConnector in the connect()
method when it calls $this->createConnection()
on line 32. That method createConnection()
passes the $dsn
string on to its call to createPdoConnection()
which instantiates a PDO
object with the same value for $dsn
.
`Illuminate\Database\Connectors\SqlServerConnector::getDsn($config)` returns:
sqlsrv:Server=localhost,1433;Database=A***e;LoginTimeout=15
$config: array (
'driver' => 'sqlsrv',
'host' => 'localhost',
'port' => '1433',
'database' => 'A***e',
'username' => '***',
'password' => '***',
'charset' => 'utf8',
'login_timeout' => 15,
'prefix' => '',
'pooling' => true,
'prefix_indexes' => true,
'foreign_key_constraints' => true,
'options' =>
array (
1005 => true, // PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE
),
'name' => 'sqlsrvAdminDB',
)
$options: array (
8 => 0, // PDO::ATTR_CASE => PDO::CASE_NATURAL
3 => 2, // PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
11 => 0, // PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL
17 => false, // PDO::ATTR_STRINGIFY_FETCHES => false
1005 => true, // PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE
)
I created a small PHP script in an effort to recreate the issue. Sadly it was unsuccessful. I will dig into the laravel framework code to attempt diagnosing the issue. Thank you for your time!
Please check the FAQ (frequently-asked questions) first. If you have other questions or something to report, please address the following (skipping questions might delay our responses):
PHP version
PHP 8.1.17 (cli) (built: Mar 16 2023 13:07:08) (NTS)
PHP SQLSRV or PDO_SQLSRV version
SQLSRV
Microsoft ODBC Driver version
unixODBC 2.3.11
SQL Server version
(running in a docker container)
Microsoft Azure SQL Edge Developer (RTM) - 15.0.2000.1574 (ARM64) Jan 25 2023 10:36:08 Copyright (C) 2019 Microsoft Corporation Linux (Ubuntu 18.04.6 LTS aarch64)
Client operating system
macOS Ventura 13.2.1 (22D68)
Problem description
Connection option
LoginTimeout
is not respected on mac driverExpected behavior and actual behavior
LoginTimeout=15
is being passed in connection string (via laravel SqlServerConnector at vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php). When server is taken offline requests timeout after 60 seconds.Repro code or steps to reproduce
This same scenario appears to work in an equivalent Windows setup -