简体   繁体   中英

Multiple Database connections - Zendframework

I want to connect multiple database connections in Zendframework application. I am not able to find any live example of the same. It would help if someone can post an example of using multiple db connections.

For example you can use this code:

// In config/autoload/global.php

'db' => [
    'adapters' => [
        'Application\Db\WriteAdapter' => [
            'driver' => 'Pdo',
            'dsn' =>   
 'mysql:dbname=application;host=canonical.example.com;charset=utf8',
        ],
        'Application\Db\ReadOnlyAdapter' => [
            'driver' => 'Pdo',
            'dsn'    => 
 'mysql:dbname=application;host=replica.example.com;charset=utf8',
          ],
       ],
    ],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM