diff -u schema-base/schema.module schema-edited/schema.module
--- schema-base/schema.module	2009-08-27 06:37:19.000000000 -0700
+++ schema-edited/schema.module	2009-12-16 10:01:23.329332908 -0800
@@ -148,6 +148,10 @@
 }
 
 function schema_invoke($op) {
+  $db_name = variable_get('schema_database_connection', 'default');
+  if($db_name !== 'default'){
+    db_set_active($db_name);
+  }
   // We could be called by other modules (notably Table Wizard or Migrate) in an update
   // function, which does not call hook_init(). So, make sure we get our include files included...
   schema_require();
@@ -156,7 +160,11 @@
   $function = 'schema_'.$db_type.'_'.$op;
   $args = func_get_args();
   array_shift($args);
-  return call_user_func_array($function, $args);
+  $return = call_user_func_array($function, $args);
+  if($db_name !== 'default'){
+    db_set_active('default');
+  }
+  return $return;
 }
 
 function schema_engine_invoke($engine, $op) {
@@ -838,6 +846,18 @@
 }
 
 function schema_settings() {
+  global $db_url;
+  if(is_array($db_url) && count($db_url) > 1){
+    $form['schema_database_connection'] = array(
+      '#type' => 'select',
+      '#title' => t('Database connection to use'),
+      '#default_value' => variable_get('schema_database_connection', 'default'),
+      '#options' => array_combine(array_keys($db_url), array_keys($db_url)),
+      '#description' => t('If you use a secondary database other than the default
+        Drupal database you can select it here and use schema\'s "compare" and
+        "inspect" functions on that other database.'),
+    );
+  }
   $form['schema_status_report'] = array(
     '#type' => 'checkbox',
     '#title' => t('Include schema comparison reports in site status report'),
