ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:loadbalancer:addconnection

addConnection

Applies To

ADOdb Load Balancer

See Also

ADOdbLoadBalancerConnection()

Syntax
 bool addConnection(
       object $ADOdbConnection
       )

Description

The method addConnection() adds an ADOdb connection, created by the instantiation of the ADOdbLoadBalancerConnection() class to the load balancer connection pool. Until the connection is added to the pool it cannot be used by the load balancer.

Note that a connection to the database is not established until the first command is executed.

The method returns true if the connection is successfully added to the pool, or false if an error occurs.


Usage

$db = new ADOdbLoadBalancer;
 
$driver = 'mysqli';
$database = 'employees';
$user     = 'adodb';
$password = 'adodb';
$host     = '192.168.0.200';
$db0 = new ADOdbLoadBalancerConnection( $driver,
                                        'write', 
                                        10, 
                                        false, 
                                        $host, 
                                        $user, 
                                        $password, 
                                        $database );
/*
* Add the connection to the pool
*/
$db->addConnection( $db0 );
v5/reference/loadbalancer/addconnection.txt · Last modified: 2017/04/25 01:08 by mnewnham