diff --git a/data.views.inc b/data.views.inc
index f7070d4..bd7edf8 100644
--- a/data.views.inc
+++ b/data.views.inc
@@ -62,6 +62,7 @@ function data_views_data() {
         'title' => check_plain($table->get('title')),
         'help' => t('Data table'),
         'weight' => 10,
+        'database' => isset($meta['database']) ? $meta['database'] : variable_get('schema_database_connection', 'default'),
       );
     }
 
diff --git a/includes/DataTable.inc b/includes/DataTable.inc
index 30a85cb..aa8f4c7 100644
--- a/includes/DataTable.inc
+++ b/includes/DataTable.inc
@@ -148,7 +148,8 @@ class DataTable {
       return FALSE;
     }
 
-    $schema = schema_dbobject()->inspect(variable_get('schema_database_connection', 'default'), $this->name);
+    $database = variable_get('schema_database_connection', 'default');
+    $schema = schema_dbobject()->inspect($database, $this->name);
     if (isset($schema[$this->name])) {
       $table = array(
         'name' => $this->name,
@@ -157,6 +158,7 @@ class DataTable {
         // Add in an empty meta array with the field names so other modules can rely on it.
         'meta' => array(
           'fields' => array_fill_keys(array_keys($schema[$this->name]['fields']), array()),
+          'database' => $database,
         ),
       );
       if (drupal_write_record('data_tables', $table)) {
