我需要将 Windows 服务器设置迁移到 Linux (Red Hat 7.2) 服务器。以前我们在 Windows 机器上使用pdo_sqlsrv驱动程序。在 Linux 上,我们安装了pdo_odbc驱动程序。但是由于 Zend Framework 2 不支持这个开箱即用,我自己使用 ZF2 API 文档找到了一个数据库配置,现在可以使用。这是配置:
'db' => array(
'driver' => 'pdo',
'username' => 'ourDbUsername',
'password' => 'ourDbPassword',
'dsn' => 'odbc:DRIVER={SQL Server Native Client 11.0};UID=ourDbUsername;PWD=ourDbPassword;DATABASE=ourDbName;SERVER=ourServerIP',
'charset' => 'UTF-8'
),
到目前为止,一切都很好。如果我们运行我们的应用程序,一切都会按预期进行,直到每次简单的 GET 请求都失败以获取对象的详细信息。即使我删除了在它之前执行的其他请求,我也无法使请求工作。即使以另一种方式链接请求也无济于事。这是错误:
Statement could not be executed (HY000 - 0 - [Microsoft][SQL Server Native Client 11.0]
Connection is busy with results for another command (SQLExecute[0] at /builddir/build/BUILD/php-5.4.16/ext/pdo_odbc/odbc_stmt.c:254) - HY000)
我们尝试设置 MARS_Connection(在 smozgur 的回答中描述了如何修复本机客户端错误 'Connection is busy with results for another command'?)。但是我们没有这样的/etc/odbc.ini 文件,只有/etc/odbcinst.ini 文件。所以我们的 /etc/odbcinst.ini 文件现在看起来像这样:
[ODBC Driver 11 for SQL Server]
Description=Microsoft ODBC Driver 11 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2270.0
Threading=1
UsageCount=1
MARS_Connection=yes
我是否错过了设置中的某些内容以使其正常工作?