I'm working on a project that needs to be connected to a MS SQL Database, I have a cloud database which is hosted in Microsoft Azure, I can access it using SQL Server Management Studio, however in my Laravel project when I tried to query I get . I already allowed my IP Address in the Azure Firewall.
PDOException in Connector.php line 47: SQLSTATE[08001]: [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [2].
Here's my config
'azure' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'ybefh1h7kh.database.windows.net,1433'),
'database' => env('DB_DATABASE', 'test'),
'username' => env('DB_USERNAME', 'myuser'),
'password' => env('DB_PASSWORD', 'password'),
'prefix' => '',
],
My query
$users = DB::connection('azure')->select("SELECT * FROM Users");
var_dump($users);exit;