Apply for Zend Framework Certification Training

Zend Framework 1




If we want to create multiple db connections 

Step 1 At application.ini
resources.multidb.db.adapter = PDO_MYSQL
resources.multidb.db.host = "localhost"
resources.multidb.db.username = "root"
resources.multidb.db.password = ""
resources.multidb.db.dbname = "staging_db1"
resources.multidb.db.default = true 
 
resources.multidb.db1.adapter = PDO_MYSQL
resources.multidb.db1.host = "localhost"
resources.multidb.db1.username = "root"
resources.multidb.db1.password = ""
resources.multidb.db1.dbname = "staging_db2"

resources.multidb.db2.adapter = PDO_MYSQL
resources.multidb.db2.host = "localhost"
resources.multidb.db2.username = "root"
resources.multidb.db2.password = ""
resources.multidb.db2.dbname = "staging_db3" 

At bootstrap.php 

$this->bootstrap('multidb');
        $resource = $this->getPluginResource('multidb');

        $db = $resource->getDb('db');
        $db1 = $resource->getDb('db1');
        $db2 = $resource->getDb('db2');
//      $Adapter2 = $resource->getDb('db2');
//      Zend_Registry::set('db1', $Adapter1);
        Zend_Registry::set('db', $db);
        Zend_Registry::set('db1', $db1);
        Zend_Registry::set('ArchivedItemizedDB', $db2);                                    

< Add Routes In Zend1 at Bootstrap Order multiple columns in Zend Framework1 >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top