Skip to content Skip to sidebar Skip to footer

Cakephp Sqlserver Encoding

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 Error: A Database connection using 'Sqlserver' was mi

Solution 1:

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
);

Solution 2:

Tried this out with Cakephp 3.0 seems to work nicely.

'Datasources' => [
    'default' => [
        'className' => 'Cake\Database\Connection',
        'driver' => 'Cake\Database\Driver\Sqlserver',
        'persistent' => false,
        'host' => 'localhost',
        'port' => '1433', //using this port'username' => 'sa',
        'password' => 'password',
        'database' => 'cake_bookmarks',
        'encoding' => PDO::SQLSRV_ENCODING_UTF8,
        'timezone' => 'UTC',
        'cacheMetadata' => true,
        'quoteIdentifiers' => false,
    ]

Solution 3:

SQL 2008 doesn't support UTF-16 only SQL 2012

http://msdn.microsoft.com/en-us/library/ms143726(v=sql.110).aspx

UTF-8 isn't supported at all by MS SQL.

Post a Comment for "Cakephp Sqlserver Encoding"