Reference to another database as a prefix
You have the format wrong for two databases you need something like this:

$databases = array(
  'default' =&gt; array(
    'default' =&gt; array(
      'database' =&gt; 'd7',
      'username' =&gt; 'root',
      'password' =&gt; 'root',
      'host' =&gt; '127.0.0.1',
      'port' =&gt; '',
      'driver' =&gt; 'mysql',
      'prefix' =&gt; '',
    ),
  ),
  'db2' =&gt; array(
    'default' =&gt; array(
      'database' =&gt; 'd7_parent',
      'username' =&gt; 'root',
      'password' =&gt; 'root',
      'host' =&gt; '127.0.0.1',
      'port' =&gt; '',
      'driver' =&gt; 'mysql',
      'prefix' =&gt; '',
    ),
  ),
);


You can then use db_set_active('db2'); to change the connection and begin querying the second database.