Reputation: 916
I'm trying to build a view from custom tables which are located in another database called 'academy'. My Drupal installation uses database 'drupal'. I've updates Drupal's settings.php file with:
$databases = array();
#DEFAULT DRUPAL DATABASE
$databases['default']['default'] = array (
'database' => 'drupal',
'username' => 'root',
'password' => '',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
);
#ACADEMY DATABASE
$databases['academy']['default'] = array (
'database' => 'academy',
'username' => 'root',
'password' => '',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
);
And cleared cache. But when I go to 'Adopt Tables' in the data module I don't see any of my tables from the 'academy' database.
Am I missing a step?
Upvotes: 0
Views: 326
Reputation: 673
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'abc',
'username' => 'root',
'password' => '',
'host' => '127.0.0.1',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
'xyz' =>
array (
'default' =>
array (
'database' => 'xyz',
'username' => 'root',
'password' => '',
'host' => '127.0.0.1',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);
I have done it like this and it's working. If your otherdatabase tables name is different, then you can call it directly; otherwise, call it with your database_name.table name.
Upvotes: 2