Sql-Server Connection Error

Hi,

I am trying to connect to SQL-Server DB from my application. It is not connecting.

I am able to connect to the DB through SQL-Server Management Studio with same login details.

I am using SQL-Server 2008.

Following is the DB component from my Yii config file -


'db'=>array(

    'connectionString' => 'sqlsrv:server=hostname;database=dbname',

    'username' => 'user',

    'password' => 'password'			

),

I am getting the following error -


CDbConnection failed to open the DB connection: SQLSTATE[IMSSP]: 

The given attribute is only supported on the PDOStatement object.

I have googled and found at many places that emulatePrepare can cause this. But I am already not using that.

Can anybody help…

Now it should works

solution is to download the PDP sqlsrv drivers AND the Microsoft SQL Server Native Client from this Microsoft page: Microsoft Drivers for PHP for SQL Server

http://msdn.microsoft.com/en-us/library/cc296170.aspx

Then you have to put the appropriate driver (see SQLSRV_Readme.htm) into the directory …\PHP\ext_ and activated them by inserting the following lines into _php.ini:

extension=php_sqlsrv_53_ts_vc9.dll

extension=php_pdo_sqlsrv_53_ts_vc9.dll

(change the dll names as needed!)

‘db’=>array(

        'connectionString' => 'sqlsrv:server=MY_SERVERNAME;Database=MY_DATABASENAME;',


        'username' => 'MY_USERNAME',


        'password' => 'MY_PASSWORD',


    ),

Ref : http://www.yiiframework.com/doc/guide/1.1/en/database.dao

check the above link :)