开发商!
我正在使用Laravel框架,我需要连接到MS SQL 2014 Express数据库.我已经在.env中进行了所有正确的配置(我甚至尝试过将连接参数直接放到database.php配置中)但是在第一次请求时我总是会遇到错误:
PDOException in Connector.php line 55:
SQLSTATE[08001]: [Microsoft][ODBC Driver 11 for SQL Server]TCP Provider: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Run Code Online (Sandbox Code Playgroud)
超时后,我总是得到这个PHP致命的:
FatalErrorException in Connector.php line 55
Invalid handle returned.
Run Code Online (Sandbox Code Playgroud)
作为开发工具我正在使用XAMPP,当我重新启动apache服务器时,有时我可以成功建立连接,但只有20-30次尝试中的1次.
Laravel正在使用PDO驱动程序,所以我尝试使用sqlsrv_connect() - 它有效!没有错误,一切都很好.
有人可以帮我配置PDO吗?Laravel只使用PDO驱动程序,因此我不能只切换到sqlsrv_connect.