Index: /trunk/FACT++/src/drivectrl.cc
===================================================================
--- /trunk/FACT++/src/drivectrl.cc	(revision 13766)
+++ /trunk/FACT++/src/drivectrl.cc	(revision 13767)
@@ -733,4 +733,6 @@
     };
 
+    string fDatabase;
+
     typedef map<string,pair<double,double>> sources;
     sources fSources;
@@ -945,4 +947,17 @@
 
             T::Out() << name << "," << ra << "," << dec << endl;
+        }
+        return T::GetCurrentState();
+    }
+
+    int ReloadSources()
+    {
+        try
+        {
+            ReadDatabase();
+        }
+        catch (const exception &e)
+        {
+            T::Error("Reading sources from databse failed: "+string(e.what()));
         }
         return T::GetCurrentState();
@@ -1140,4 +1155,8 @@
             ("Print source list.");
 
+        T::AddEvent("RELOAD_SOURCES")
+            (bind(&StateMachineDrive::ReloadSources, this))
+            ("Reload sources from database.");
+
         fDrive.StartConnect();
     }
@@ -1148,5 +1167,5 @@
     }
 
-    void ReadDatabase(const string &database)
+    void ReadDatabase(bool print=true)
     {
         //static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))?");
@@ -1159,9 +1178,9 @@
 
         boost::smatch what;
-        if (!boost::regex_match(database, what, expr, boost::match_extra))
-            throw runtime_error("Couldn't parse '"+database+"'.");
+        if (!boost::regex_match(fDatabase, what, expr, boost::match_extra))
+            throw runtime_error("Couldn't parse '"+fDatabase+"'.");
 
         if (what.size()!=10)
-            throw runtime_error("Error parsing '"+database+"'.");
+            throw runtime_error("Error parsing '"+fDatabase+"'.");
 
         const string user   = what[2];
@@ -1200,4 +1219,5 @@
         }*/
 
+        fSources.clear();
         for (vector<mysqlpp::Row>::const_iterator v=res.begin(); v<res.end(); v++)
         {
@@ -1209,7 +1229,10 @@
             fSources[name] = make_pair(ra, dec);
 
-            ostringstream msg;
-            msg << " " << name << setprecision(8) << ":   Ra=" << ra << "h Dec=" << dec << "deg";
-            T::Message(msg);
+            if (print)
+            {
+                ostringstream msg;
+                msg << " " << name << setprecision(8) << ":   Ra=" << ra << "h Dec=" << dec << "deg";
+                T::Message(msg);
+            }
         }
     }
@@ -1255,5 +1278,8 @@
 
         if (conf.Has("source-database"))
-            ReadDatabase(conf.Get<string>("source-database"));
+        {
+            fDatabase = conf.Get<string>("source-database");
+            ReadDatabase();
+        }
 
         // The possibility to connect should be last, so that
