Index: trunk/psModules/src/config/pmConfig.c
===================================================================
--- trunk/psModules/src/config/pmConfig.c	(revision 17548)
+++ trunk/psModules/src/config/pmConfig.c	(revision 17874)
@@ -880,4 +880,13 @@
     }
 
+    if (!config->database) {
+        psDB *dbh = pmConfigDB(config); // Database handle
+        if (!dbh) {
+            psError(PS_ERR_UNKNOWN, false, "Unable to open database connection.");
+            psFree(config);
+            return NULL;
+        }
+        config->database = dbh;
+    }
 
     psErrorClear();   // we may have failed to find some items in the metadata
@@ -1344,5 +1353,5 @@
     }
 
-    // no files found: this is not really an error 
+    // no files found: this is not really an error
     if (files->n == 0) {
         psFree (files);
@@ -1553,8 +1562,31 @@
     psMetadata *scheme = psMetadataLookupMetadata(&mdok, fitstypes, fitsType);
     if (!scheme) {
-	psWarning("Unable to find specified FITS Type %s in camera configuration.", fitsType);
-	return NULL;
+        psWarning("Unable to find specified FITS Type %s in camera configuration.", fitsType);
+        return NULL;
     }
 
     return scheme;
 }
+
+
+#if 0
+bool pmConfigDump(const pmConfig *config, const pmFPA *source, const char *outroot)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+    PS_ASSERT_STRING_NON_EMPTY(outroot, false);
+
+    pmFPAview *view = source ? pmFPAviewTop(source) : pmFPAviewAlloc(0);// View to top level
+    if (!view) {
+        psError(PS_ERR_UNKNOWN, false, "Unable to determine top view for FPA.");
+        return false;
+    }
+
+    psMetadata *dumpRules = psMetadataLookupMetadata(NULL, config->system, "CONFIG.RULES"); // Name rules
+    if (!dumpRules) {
+        psError(PS_ERR_UNKNOWN, false, "Unable to find CONFIG.RULES in system configuration");
+        psFree(view);
+        return false;
+    }
+
+    const char *name =
+#endif
