- v5:loadbalancer:mysql_replication:automatic_control|Automatic Control ^ v5:loadbalancer:index|ADOdb Loadbalancer ^ v5:loadbalancer:mysql_replication:manual_configuration|Manual Configuration ->
~~NOTOC~~
====== Debugging Connections ======
Using the ADOdb [[v5:userguide:debug|debugging]] feature differs slightly from the normal database connection, because the load balancer class is instantiated before any database connections are made. There is, therefore, a period during which no debugging information is available.
Once a connection has been made, then the debugging flag can be applied. Debugging at this point is applied to **All** connections in the pool. This means, however, that debugging problems with establishing connections is difficult to do in the context of the load balancer connection pool.
$db = new ADOdbLoadBalancer;
/*
* We cannot enable debugging here
*/
$driver = 'mysqli'
$database = 'employees';
$user = 'adodb';
$password = 'adodb';
$host = '192.168.0.200';
$db0 = new ADOdbLoadBalancerConnection( $driver,
'write',
10,
false,
$host,
$user,
$password,
$database );
$db0->getADODbObject()
$db->addConnection( $db0);
/*
* Enable debugging for connection $db0 and all subsequent connections
*/
$db->debug = true;
Because establishing a database through the connection pool is exactly the same as a connection directly through ADOdb, the best way to establish a connection is to temporarily craft a standard ADOdb connection in your code, and test it using ADOdb debugging.
===== Debugging an individual connection =====
To debug an individual connection in the connection pool use the following code method:
$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 );
/*
* Enable debugging for connection $db0 only
*/
$db0->getADODbObject()->debug = true;
$db->addConnection( $db0);