gpt4 book ai didi

php - Cakephp Sqlserver编码

转载 作者:可可西里 更新时间:2023-11-01 13:37:01 25 4
gpt4 key购买 nike

这让我难住了。我正在尝试为我的 Sqlserver 连接设置编码,但我尝试的所有操作都失败了。我只得到

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.

我试图通过编码解决的原始错误是:

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

最佳答案

经过大量的试验和错误后,这是可行的:

public $default = array(
'datasource' => 'Database/Sqlserver',
'persistent' => false,
'host' => 'localhost',
'login' => 'sa',
'password' => 'password',
'database' => 'SchedulingDatabase',
'encoding' => PDO::SQLSRV_ENCODING_UTF8
);

关于php - Cakephp Sqlserver编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20042778/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com