I am new to Yii but familiar with MVC, Ubuntu, and php development. The primary database for my app will be a mysql database but the app will also need to be able to connect to two different MSSQL databases to import and export some data. I’m having some trouble getting the connection to the Microsoft SQL database to work.
When I use the connection string:
'db'=>array(
'connectionString' => 'mssql:host=192.168.2.5;dbname=prism',
'emulatePrepare' => false,
'username' => 'myUser',
'password' => 'myPass',
'charset' => 'utf8',
),
I get the error: CDbConnection failed to open the DB connection: could not find driver
So I also tried the connection string:
'db'=>array(
'connectionString' => 'dblib:host=192.168.2.5;dbname=prism',
'emulatePrepare' => false,
'username' => 'myUser',
'password' => 'myPass',
'charset' => 'utf8',
),
With error: CDbConnection failed to open the DB connection: SQLSTATE[IM001]: Driver does not support this function: driver does not support setting attributes
I also tried the connection string:
'db'=>array(
'connectionString' => 'dblib:host=192.168.2.5;dbname=prism,myUser,myPass',
'emulatePrepare' => false,
'username' => 'myUser',
'password' => 'myPass',
'charset' => 'utf8',
),
This time with error: CDbConnection failed to open the DB connection: SQLSTATE[HY000] General SQL Server error: Check messages from the SQL Server (severity 16)
At this point I’m kinda at a loss. There don’t seem to be any messages printing out in the apache logs.
Current setup:
Ubuntu Oneiric (11.10)
php 5.3.6-13
phpInfo() shows the following: PDO drivers dblib, mysql, odbc
and I have the php5-sybase package installed.
I can connect to mssql via the mssql_connect() function in other php apps so I know that as working but for some reason the pdo won’t connect.
Any ideas?