we are trying to somehow show fields from nodes existing in a different drupal database than the default. Eg. in the site the module is installed (drupal2) we have the following settings.php

$databases = array ( 'drupal1db' => array ( 'default' => array ( 'database' => 'drupal1db', .... 'default' => array ( 'default' => array ( 'database' => 'drupal2db', ...

is there a way to override views so that it displays content with specific type "eg news" from the drupal1db and/or from both the databases?

Thank you

1 Answer 1


Absolutely you can use a different db for a view. First create a custom module use hook_views_data() in a .views.inc file to define the fields of the external db. Once you have defined the fields and cleared the cache you will be able to select a different base table for your view.

With some custom coding and db_set_active() or views relationships you should be able to use both.

EDIT: Assuming Drupal 7.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.