【问题标题】:Laravel 4 + CentOS + MSSQL 2012 = errorLaravel 4 + CentOS + MSSQL 2012 = 错误
【发布时间】:2015-09-23 12:45:32
【问题描述】:
我的 laravel 4 应用程序正在从 MSSQL 2012 服务器检索数据。它在 Windows 上运行良好,但在 CentOS 上部署时出现以下错误:
下一个异常“Illuminate\Database\QueryException”带有消息“SQLSTATE[HY000]:一般错误:4004 一般 SQL Server 错误:检查来自 SQL Server [4004](严重性 16)[(null)] 的消息
检查了 MSSQL 错误映射,确切的错误是:
使用 DB-Library (z. B. isql) 或 ODBC 版本 3.7 或更早版本无法将仅 Unicode 排序规则中的 Unicode 数据或 ntext 数据发送到客户端。
谷歌搜索后,我唯一发现的是 freetds 版本太低,我在 etc/freetds.conf 中将其从 4.2 更改为 7.0 - 没有任何变化。请告知这里可能是什么问题。
【问题讨论】:
标签:
php
sql-server
laravel
unicode
【解决方案1】:
快速搜索并发现了更多您可以做的事情:
In /etc/freetds/freetds.conf add these two lines (last two):
[global]
;tds version = 4.2
tds version = 8.0
client charset = UTF-8
You can edit "charset" in php.ini too (but you don't need if you did it previously in freetds.conf):
;Specify client character set..
;If empty or not set the client charset from freetds.comf is used
;This is only used when compiled with FreeTDS
mssql.charset = "UTF-8"
希望这行得通。
【解决方案2】:
就像你引用的那样:
无法发送仅 Unicode 排序规则中的 Unicode 数据或 ntext 数据
使用 DB-Library (z. B. isql) 或 ODBC 版本 3.7 或
早期使用。
所以您需要升级ODBC 驱动程序不 freetds,在您的情况下,您可能需要考虑升级unix-odbc。