Sql Server 2005 / PDO / PHP 5.3.3 connection problem

Hi all,

I’m very impressed with Yii. I’ve dome some tests on my linux box connected to a MySql or SQlite3 db without any problem. I’m now trying to connect Yii with MS Sql Server 2005 on my company environment:

Sql Server 2003

PHP 5.3.3 on IIS6 (php-cgi with fastcgi)

php_pdo_sqlsrv_53_nts_vc9.dll, php_sqlsrv_53_nts_vc9.dll, php_pdo_odbc.dll drivers

The problem is that I’m not able to estabilish the connection with Sql Server.

Odbc connection:




odbc:Driver={SQL Server Native Client 10.0};Server=<NAME>;Database=<NAME>;



Error: CDBconnection failed to open the DB connection: SQLSTATE[42000]: Syntax error or access violation: 102

SqlSrv connection




sqlsrv:server=<NAME>;dbname=<NAME>;



Error: CDBconnection failed to open the DB connection: SQLSTATE[IMSSP]: An unsupported attribute was designed on the PDO object

Mssql connection




mssql:server=<NAME>;dbname=<NAME>;



Error: CDBconnection failed to open the DB connection: could not find driver (php 5.3.3 has no php_mssql.dll driver)

Please, let me know if someone has the solution for this…

Finally I’ve found the correct connection string:




'db'=>array(

'connectionString' => 'sqlsrv:server=xyz;database=xyz;',

'emulatePrepare' => false,

'username' => 'xyz',

'password' => 'xyz',

'charset' => 'utf8',

),



the problem was emulatePrepare (false is ok)

‘emulatePrepare’ => false,

I’ve tried this solution, but without result

But…

I solve this problem removing the "emulatePrepare" attribute, like this:




                'db'=>array(

                            'connectionString' => 'sqlsrv:server=localhost;database=Northwind;',

                            'username' => 'user',

                            'password' => 'user123',

                            'charset' => 'utf8',

                        ),