AR with MS SQL Db


I’m trying now for hours to get my yii app to work with a MS sql db, I read any articel in the web that is providet by google, but I don’t get it!!! ;(

My Yii connection string is:


				'connectionString'=>'mssql:host=SERVER\SQLEXPRESS;dbname=dbname', 'username'=>'sa', 'password'=>'sql_server_pass', 'charset'=>'utf8'


And I get the exception:

SQLSTATE[01002] Unable to connect: SQL Server is unavailable or does not exist. Access denied. (severity 9)

But I use the same login data in Visual Studio (Also on my local pc, not on SERVER) and there everything works fine.

I have no ideas, maybe Apache or PHP blocks the connection, I don’t know ;(

Any ideas Guys?


My System is Windows (Both, server and my client) and on my client I have installed "wampserver 2.0h"

Best regards


Unbelievble, my last try was to copy a dll in the apache/bin folder and know I got a different exception, mybe better??? :)

It says:

SQLSTATE[HY000]: General error: 10007 ‘NAMES’ wird nicht als SET-Option erkannt. [10007] (severity 5) []

On english:

General error: 10007 ‘NAMES’ is not known as SET-option. [10007] (severity 5) []

No one can help me ;(

I need it for my job.

try commenting out the line “‘charset’=>‘utf8’”.

with mssql you need to provide the charset within the dsn.

I always use this in my config (to connect to MSSQL)



	'connectionString' => 'mssql:host=;dbname=MyDB', 'username'=>'sa', 'password'=>'mypwd'


host is my computer’s IP number