Reputation: 35
I am trying to connect my yii application to ms sql server which has no named instance, just the default one, but i keep getting this error, "CDbConnection failed to open the DB connection" . Here is my connection string
'db'=>array('connectionString' => 'sqlsrv:Server=DGTSW00020US2;database=myDB',
'username' => 'sa',
'password' => '*****',
'charset' => 'utf8',
'emulatePrepare' => false),
Any ideas?
Upvotes: 0
Views: 239
Reputation: 35
Finally guys I manged to solve my problem, I commented out this line ('emulatePrepare' => false ) and it worked properly.
Thank you
Upvotes: 0
Reputation: 1604
Change your string to
'db'=>array('connectionString' => 'mssql:Server=DGTSW00020US2;database=myDB',
'username' => 'sa',
'password' => '*****',
'charset' => 'utf8',
'emulatePrepare' => false),
(e.g. Change the
sqlsrv:Server=DGTSW00020US2;database=myDB
to
mssql:Server=DGTSW00020US2;database=myDB
)
Source: Yii Frameowrk - Data Access Objects (DAO)
Upvotes: 1