2016-11-22 1 views
0

하이브 데이터베이스를 YII 프레임 워크에 연결하는 방법을 아는 사람은 누구입니까? ODBC 연결의 경우 YII의 설명서는 다음 코드를 제공합니다. 그러나 그것은 효과가 없습니다.하이브 데이터베이스와 yii의 데이터베이스 연결

array(
    ...... 
    'components'=>array(
     ...... 
     'db'=>array(
      'class'=>'CDbConnection', 
      'connectionString'=>'mysql:host=localhost;dbname=testdb', 
      'username'=>'root', 
      'password'=>'password', 
      'emulatePrepare'=>true, // needed by some MySQL installations 
     ), 
    ), 
) 

답변

0

ODBC 당신은 http://www.yiiframework.com/doc/guide/1.1/it/database.dao

ODBC를 사용하여, 그 연결 문자열 (DSN)이 등 (MySQL은, MS SQL 서버, 사용되는 어떤 데이터베이스 유형 고유 을 표시하지 않습니다 사용할 수 있습니다). 따라서 은 필요한 DBMS 특정 클래스 (CMysqlSchema, CMssqlSchema 등)을 자동으로 감지 할 수 없습니다. 당신이 CDbConnection 클래스의 $적인 driverName 속성을 사용하는 이유가 명확 할 것

:

array(
    ...... 
    'components'=>array(
    ...... 
    'db'=>array(
     'class'=>'CDbConnection' 
     'driverName'=>'mysql', 
     'connectionString'=>'odbc:Driver={MySQL};Server=127.0.0.1;Database=test', 
     'username'=>'', 
     'password'=>'', 
    ), 
), 
) 
+0

나는 또한이 시도하지만 –

+0

당신이 적절한 데이터베이스를 잘 살고 적이 연결을 설정하지 않고, 사용자 이름과 패스워드? – scaisEdge

관련 문제