ycast
(Mail2)
1
Hi all
I would like to connect to a remote MS-SQL Server with the pdo_dblib driver (freetds) on CentOS 5.5.
After some minor problems with the OS configuration, I finally got the connection working with a manual connect with
$connection=new CDbConnection($dsn,$username,$password);
Unfortunately, when using the Yii database component (as specified in config/main.php) I get the following error:
when I try to retrieve the connection with this code in my Controller:
$connection = Yii::app()->db;
My db settings are as follows:
'db'=>array(
'connectionString' => 'dblib:host=SERVER_IP;dbname=DB',
'emulatePrepare' => false,
'username' => 'USER',
'password' => 'PASS',
'charset' => 'utf8',
),
Any ideas why this is happening?
I would really like to use the “shared” connection instead of create a new one every time 
Best regards
ycast
ycast
(Mail2)
3
Hi Gustavo. In my case, the PDO driver is installed and does work if I connect manually with
$connection=new CDbConnection($dsn,$username,$password);
.
But not when using
$connection = Yii::app()->db;
together with the db settings in config/main.php.
gusnips
(Gustavo)
4
true, I read it in a hurry
the problem is that you can’t set attributes to this driver
'charset' => 'utf8','emulatePrepare' => false,
I’m not sure tho which attributes you can or cannot set, as I haven’t used this driver yet
ycast
(Mail2)
5
Yeah! You were right: it was because of charset and emulatePrepare. Thanks alot 
I think you can set the charset in freetds.conf with "client charset = UTF-8".
marinovdf
(Marinovdf)
6
Gustavo, Thanks. It works
Blaza
(Blaza)
7
Form me removing only ‘emulatePrepare’ => false,’ was enough
shgninc
(Shgninc)
9
So Thank`s, My I ask you to describe emulatePrepare in Yii db?