Drupal: Using Views Database Connector (VDC) To Display Data in External Database

Mon, Jul 6, 2015

Apart from Drupal most organisations may have many systems such as a CRM, HR and e-commerce system. The field of Business Intelligence (BI) deals with bringing disparate data sources into a single data warehouse(DW). If you wanted to display data from your DW using Drupal, the Views module is a good place to start. Before you can use the Views module you need to connect to the database and describe the tables to Views. I am a SQL developer so I am reluctant to write my own module. I found there are several modules that enable me to show external data in Views:

With Drupal 8 around the corner I decided to try out the only module that has a Drupal 8 version at the time of writing, the VDC module. Using the Chinook database I use as a sample database I was able to achieve my goal quite easily.

  • I already had Views installed my site so I just had to download and enable VDC.

  • I installed the Chinook database as a separate from my Drupal database. Then added a connection which looked like this in my settings.php file:

'database' => 'chinook',
'username' => 'my-username',
'password' => 'my-password,
'host' => 'host',

I followed the instructions in the README.txt file. The first step was to create a new View of type VDC. In the add new view option dialog, I was presented with my list of tables in the Chinook database. Each table to was prefixed with [VDC]chinook_mysql, the module and connection name.

Drupal VDC module

I created a table display for the data. To make the View more useful to end users I added an exposed filter on the City column. You can see the View for yourself here.

VDC Chinook Employee Table


VDC made the process of incorporating some external data into Drupal simple. The none full-time PHP developer like is grateful to the module developer I didn’t have to write code which I was going to struggle to maintain. From a BI perspective this means I can focus most of my energy on structuring my DW, a challenge on its own. For organisations with different applications running on different databases, VDC enables you to continue running your separate applications but present all information from the different systems in Drupal. Such functionality is very useful in Intranet applications. Once your external data is in Views, you will be able to use the Views-related contributed modules. In my next blog post I am going to see which Views add-ons can be used to make Views a viable BI platform in conjunction with VDC.

Tags bi/business intelligence/data warehousing/drupal as data platform/drupal external data/drupal planet/drupal views/

Related Posts

Simplifying Lengthy SQL Scripts
Drupal: Filters for External Data Views