Laravel how to fix Illuminate\Database\QueryException SQLSTATE[IMSSP]

Viewed 49

I tried to run: php artisan migrate

Also to connect to SQL Server using Xampp on Windows.

SQL Server 2008

PHP Version 8.1.4

Laravel Framework 9.29.0

Windows 7 64 bit maximum

I Got this error:

C:\xampp\htdocs\LaraUral>php artisan migrate

   Illuminate\Database\QueryException

  SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver for SQL Ser ver to communicate with SQL Server. Access the following URL to download the ODB C Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712 (SQL: select * from sys.sysobjects where id = object_id(migrations) and xtype in  ('U', 'V'))

  at C:\xampp\htdocs\LaraUral\vendor\laravel\framework\src\Illuminate\Database\C onnection.php:759
    755aЦХ         // If an exception occurs when attempting to run a query, we' ll format the error
    756aЦХ         // message to include the bindings with SQL, which will make this exception a
    757aЦХ         // lot more helpful to the developer instead of just the data base's errors.
    758aЦХ         catch (Exception $e) {   az? 759aЦХ             throw new QueryException(
    760aЦХ                 $query, $this->prepareBindings($bindings), $e
    761aЦХ             );
    762aЦХ         }
    763aЦХ     }

  1   C:\xampp\htdocs\LaraUral\vendor\laravel\framework\src\Illuminate\Database\ Connectors\Connector.php:70
      PDOException::("SQLSTATE[IMSSP]: This extension requires the Microsoft ODB C Driver for SQL Server to communicate with SQL Server. Access the following URL  to download the ODBC Driver for SQL Server for x64: https://go.microsoft.com/fw link/?LinkId=163712")

  2   C:\xampp\htdocs\LaraUral\vendor\laravel\framework\src\Illuminate\Database\ Connectors\Connector.php:70
      PDO::__construct("sqlsrv:Server=127.0.0.1,1433;Database=xproject2", "sa", "123456789", [])

.env file:

DB_CONNECTION=sqlsrv
DB_HOST=127.0.0.1
DB_PORT=1433
DB_DATABASE=xproject2
DB_USERNAME=sa
DB_PASSWORD="123456789"
1 Answers
Related