1
我想知道是否有可能CodeIgniter 2與Doctrine 2與多個數據庫連接。CodeIgniter 2 + Doctrine 2與多個數據庫連接
我目前得到CodeIgniter 2和Doctrine 2與1數據庫一起工作,但它可以做多個數據庫嗎?
如果是這樣,該如何完成?
我想知道是否有可能CodeIgniter 2與Doctrine 2與多個數據庫連接。CodeIgniter 2 + Doctrine 2與多個數據庫連接
我目前得到CodeIgniter 2和Doctrine 2與1數據庫一起工作,但它可以做多個數據庫嗎?
如果是這樣,該如何完成?
我不確定您是否可以在兩個數據庫直接交互的情況下執行此操作。 (跨數據庫連接的/ etc ..)
但是在裝載了教義,你可能有沿此線的東西:
// Database connection information
$connectionOptions = array(
'driver' => 'pdo_mysql',
'user' => $db['default']['username'],
'password' => $db['default']['password'],
'host' => $db['default']['hostname'],
'dbname' => $db['default']['database']
);
// Create EntityManager
$this->em = EntityManager::create($connectionOptions, $doctrine_config);
當你只配置第二個實體管理的其他數據庫,也許與一個獨立的教條配置:
// Database connection information
$connectionOptions2 = array(
'driver' => 'pdo_mysql',
'user' => $db['other']['username'],
'password' => $db['other']['password'],
'host' => $db['other']['hostname'],
'dbname' => $db['other']['database']
);
// Create EntityManager
$this->emOther = EntityManager::create($connectionOptions2, $doctrine_config2);
謝謝,這有點幫助,我做,但是想要執行跨數據庫連接... – YTKColumba