I can't connect to sql-server in Laravel. I have given sqlserver configuration values in .env but still below error while running command "php artisan migrate".
SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it. (Connection: sqlsrv, SQL: select * from sys.sysobjects where id = object_id(migrations) and xtype in ('U', 'V'))
View the database connection configuration in the .env file below.
DB_CONNECTION=sqlsrv DB_HOST=DESKTOP-1CGE50Q #I have also tried here to passing system IPv4 DB_PORT=1433 DB_DATABASE=laravel_dev DB_USERNAME=DESKTOP-1CGE50Q\Dell DB_PASSWORD=
<?php $serverName = "DESKTOP-1CGE50Q, 1433"; $connectionInfo = array( "Database"=>"laravel_dev", "UID" => "DESKTOP-1CGE50Q\Dell"); $conn = sqlsrv_connect( $serverName, $connectionInfo); ?>
I have set up the Laravel site in IIS server and it is working fine. It's just a sqlServer connection issue.
If anyone has any solutions or ideas for the above problem, please let me know.
Thanks in advance.
My problem is solved and here is the solution. https://github.com/laravel/framework/issues/47937
Additionally, it can be used with Windows Authentication. Thanks.