这让我很难过.我正在尝试为我的 Sqlserver 连接设置编码,但我尝试的所有方法都失败了.我只得到
This has me stumped. I am trying to set encoding for my Sqlserver connection and all that I have tried has failed. I only get
错误:使用Sqlserver"的数据库连接丢失或无法连接连接.
数据库服务器返回此错误:SQLSTATE[IMSSP]: 指定的编码无效SQLSRV_ATTR_ENCODING.
Error: A Database connection using "Sqlserver" was missing or unable to connect.
The database server returned this error: SQLSTATE[IMSSP]: An invalid encoding was specified for SQLSRV_ATTR_ENCODING.
我试图通过编码解决的原始错误是:
The original error I was trying to solve through encoding is:
错误:SQLSTATE[IMSSP]:翻译查询字符串时发生错误到 UTF-16:目标中不存在 Unicode 字符的映射多字节代码页.
Error: SQLSTATE[IMSSP]: An error occurred translating the query string to UTF-16: No mapping for the Unicode character exists in the target multi-byte code page.
SQL 版本为 2008 R2
Cakephp 版本:2.4.2
PHP 版本:5.3.27
The SQL version is 2008 R2
Cakephp Version: 2.4.2
PHP Version: 5.3.27
经过大量的试验和错误,这有效:
After a lot of trial and error this works:
public $default = array(
'datasource' => 'Database/Sqlserver',
'persistent' => false,
'host' => 'localhost',
'login' => 'sa',
'password' => 'password',
'database' => 'SchedulingDatabase',
'encoding' => PDO::SQLSRV_ENCODING_UTF8
);
这篇关于Cakephp Sqlserver 编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!