我試圖在Linux上使用cakephp 2.0.5訪問第二個MS SQL數據庫。cakephp 2.0.5 Sqlserver需要數據庫連接
我已經安裝了sqlserver的數據源在配置/ database.php中
public $msdb = array(
'datasource' => 'Database/Sqlserver',
'persistent' => false,
'host' => 'xxx.xxx.xxx.xxx',
'port' => '1433',
'login' => 'username',
'password' => 'password',
'database' => 'DB',
'prefix' => '',
);
但是我得到這個錯誤:
Missing Database Connection
Error: Sqlserver requires a database connection
Error: Confirm you have created the file : app/Config/database.php.
Notice: If you want to customize this error message, create app/View/Errors/missing_connection.ctp.
堆棧跟蹤的CakePHP的
#0 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Model/ConnectionManager.php(101): DboSource->__construct(Array)
#1 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Model/Model.php(3234): ConnectionManager::getDataSource('msdb')
#2 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Model/Model.php(1030): Model->setDataSource('msdb')
#3 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Model/Model.php(3258): Model->setSource('PERSON')
#4 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Model/Model.php(2483): Model->getDataSource()
#5 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Controller/Component/PaginatorComponent.php(172): Model->find('all', Array)
#6 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Controller/Controller.php(1025): PaginatorComponent->paginate(NULL, Array, Array)
#7 /var/www/html/modip/app/Controller/PersonsController.php(7): Controller->paginate()
#8 [internal function]: PersonsController->index()
#9 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Controller/Controller.php(473): ReflectionMethod->invokeArgs(Object(PersonsController), Array)
#10 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Routing/Dispatcher.php(104): Controller->invokeAction(Object(CakeRequest))
#11 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Routing/Dispatcher.php(86): Dispatcher->_invoke(Object(PersonsController), Object(CakeRequest), Object(CakeResponse))
#12 /var/www/html/modip/app/webroot/index.php(96): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#13 {main}
外面,我可以訪問它沒有任何問題使用
mssql_connect("ip_addr:1433", $user, $pass);
還有什麼我應該做的嗎?
我debuged多一點,並認爲它在
的lib /蛋糕/型號/數據源/數據庫失敗/ Sqlserver.php在
public function enabled() {
return in_array('sqlsrv', PDO::getAvailableDrivers());
}
有一個在PDO司機沒有SQLSRV 。如果我從varius文檔正確理解,
sqlsrv適用於Windows。
我該如何將它用於linux?
感謝