【发布时间】:2017-10-05 13:58:27
【问题描述】:
操作系统:debian/contrib-jessie64 SQL Server 2014 速成版 PHP 5.6 Laravel 5.4
使用 tinker 可以在不同的连接上运行查询,但在“浏览器模式”下无法连接到多个连接。
我在某个控制器中有这个:
$this->saveToAnotherConnection();
$row = \Contoso\Apartment::findOrNew($this->request['ApartmentID']);
$row->fill($this->request->all());
$row->save();
saveToAnotherConnection 函数打开一个 PDO 连接但抛出异常:
$this->connection = new \PDO("dblib:host=10.0.1.11;dbname=Contoso", "sa", "sa sa ya tu sa! ya tu sa!");
异常信息:
SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)
我没有使用 Laravel 数据库配置,因为我使用的是接收 $this->connection 实例的库。
【问题讨论】:
标签: php sql-server laravel freetds