system
(system)
1
Hi, I'm using Progress database, and I'd like to know what's the DSN for it if I were to connect to it via ODBC?
In good old php, i'd done something like this
$conn=odbc_connect('northwind','username','password');
How do I do it in Yii?
$dsn=“odbc:
?
”;
$connection=new CDbConnection($dsn);
I'm sure it should be rather simple… but the combinations i tried didn't work
qiang
(Qiang Xue)
2
You need to check PHP PDO manual. However, AFAIK, PDO doesn't have good support for ODBC. And Yii AR doesn't support it.
Ismael
(Shalanga)
3
This worked for me:
$connection=new CDbConnection(‘odbc:myDb’);
$connection->active=true;
$command=$connection->createCommand(‘SELECT now() as data’);
$command->execute();
$reader=$command->query();
foreach($reader as $value)
{
echo $value['data'];
}