I’ve a yii2 app that must connect to both MySQL and MS SQL Server databases. MySQL connection works just fine, but when I try to connect MS SQL Server database I get this error message:
Database Exception – yii\db\Exception
SQLSTATE[01002] Adaptive Server connection failed (severity 9)
Caused by: PDOException
SQLSTATE[01002] Adaptive Server connection failed (severity 9)
in /opt/lampp/htdocs/default/crm/vendor/yiisoft/yii2/db/Connection.php at line 602
My database config is this one:
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=127.0.0.1;dbname=XXX',
'username' => 'XXX',
'password' => 'XXX',
'charset' => 'utf8',
],
'db2' => [
'class' => 'yii\db\Connection',
'dsn' => 'dblib:host=XXX:1433;dbname=XXX',
'username' => 'XXX',
'password' => 'XXX',
'charset' => 'utf8',
],
Any hint is welcome. I’m totally lost =(