Index: /trunk/FACT++/src/Configuration.cc
===================================================================
--- /trunk/FACT++/src/Configuration.cc	(revision 14044)
+++ /trunk/FACT++/src/Configuration.cc	(revision 14045)
@@ -332,9 +332,8 @@
 #include <iomanip>
 
-#include <boost/regex.hpp>
 #include <boost/filesystem.hpp>
 
 #ifdef HAVE_SQL
-#include <mysql++/mysql++.h>
+#include "Database.h"
 #endif
 
@@ -391,55 +390,14 @@
     Configuration::parse_database(const string &prgname, const string &database, const po::options_description& desc, bool allow_unregistered)
 {
-    //static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))?");
-    static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))");
-    // 2: user
-    // 4: pass
-    // 5: server
-    // 7: port
-    // 9: db
-
-    boost::smatch what;
-    if (!boost::regex_match(database, what, expr, boost::match_extra))
-        throw runtime_error("Couldn't parse '"+database+"'.");
-
-    if (what.size()!=10)
-        throw runtime_error("Error parsing '"+database+"'.");
-
-    const string user   = what[2];
-    const string passwd = what[4];
-    const string server = what[5];
-    const string db     = what[9];
-    const int port      = atoi(string(what[7]).c_str());
-
-    cout << "Connecting to '";
-    if (!user.empty())
-        cout << user << "@";
-    cout << server;
-    if (port)
-        cout << ":" << port;
-    if (!db.empty())
-        cout << "/" << db;
-    cout << "' for " << prgname << endl;
-
-    mysqlpp::Connection conn(db.c_str(), server.c_str(), user.c_str(), passwd.c_str(), port);
-    /* throws exceptions
-    if (!conn.connected())
-    {
-        cout << "MySQL connection error: " << conn.error() << endl;
-        throw;
-    }*/
+    Database db(database);
+
+    cout << "Connected to '" << db.database() << "' for " << prgname << endl;
 
     const mysqlpp::StoreQueryResult res =
-        conn.query("SELECT CONCAT(fKey1,fKey2), fValue "
-                   "FROM ProgramOption "
-                   "WHERE fCounter=(SELECT MAX(fCounter) FROM History) "
-                   "AND NOT ISNULL(fValue) "
-                   "AND (fProgram='"+prgname+"' OR fProgram='*')").store();
-    /* throws exceptions
-    if (!res)
-    {
-        cout << "MySQL query failed: " << query.error() << endl;
-        throw;
-    }*/
+        db.query("SELECT CONCAT(fKey1,fKey2), fValue "
+                 "FROM ProgramOption "
+                 "WHERE fCounter=(SELECT MAX(fCounter) FROM History) "
+                 "AND NOT ISNULL(fValue) "
+                 "AND (fProgram='"+prgname+"' OR fProgram='*')").store();
 
     set<string> allowed_options;
Index: /trunk/FACT++/src/drivectrl.cc
===================================================================
--- /trunk/FACT++/src/drivectrl.cc	(revision 14044)
+++ /trunk/FACT++/src/drivectrl.cc	(revision 14045)
@@ -8,5 +8,5 @@
 
 #ifdef HAVE_SQL
-#include <mysql++/mysql++.h>
+#include "Database.h"
 #endif
 
@@ -1226,53 +1226,10 @@
     {
 #ifdef HAVE_SQL
-        //static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))?");
-        static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))");
-        // 2: user
-        // 4: pass
-        // 5: server
-        // 7: port
-        // 9: db
-
-        boost::smatch what;
-        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 '"+fDatabase+"'.");
-
-        const string user   = what[2];
-        const string passwd = what[4];
-        const string server = what[5];
-        const string db     = what[9];
-        const int port      = atoi(string(what[7]).c_str());
-
-        ostringstream out;
-        out << "Connecting to '";
-        if (!user.empty())
-            out << user << "@";
-        out << server;
-        if (port)
-            out << ":" << port;
-        if (!db.empty())
-            out << "/" << db;
-
-        T::Message(out);
-
-        mysqlpp::Connection conn(db.c_str(), server.c_str(), user.c_str(), passwd.c_str(), port);
-        /* throws exceptions
-         if (!conn.connected())
-         {
-             cout << "MySQL connection error: " << conn.error() << endl;
-             throw;
-         }*/
+        Database db(fDatabase);
+
+        T::Message("Connected to '"+db.database()+"'");
 
         const mysqlpp::StoreQueryResult res =
-            conn.query("SELECT fSourceName, fRightAscension, fDeclination FROM source").store();
-        /* throws exceptions
-        if (!res)
-        {
-            cout << "MySQL query failed: " << query.error() << endl;
-            throw;
-        }*/
+            db.query("SELECT fSourceName, fRightAscension, fDeclination FROM source").store();
 
         fSources.clear();
Index: /trunk/FACT++/src/smartfact.cc
===================================================================
--- /trunk/FACT++/src/smartfact.cc	(revision 14044)
+++ /trunk/FACT++/src/smartfact.cc	(revision 14045)
@@ -7,5 +7,5 @@
 
 #ifdef HAVE_SQL
-#include <mysql++/mysql++.h>
+#include "Database.h"
 #endif
 
@@ -1739,23 +1739,6 @@
         try
         {
-            static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))");
-
-            boost::smatch what;
-            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 '"+fDatabase+"'.");
-
-            const string user   = what[2];
-            const string passwd = what[4];
-            const string server = what[5];
-            const string db     = what[9];
-            const int port      = atoi(string(what[7]).c_str());
-
-            mysqlpp::Connection conn(db.c_str(), server.c_str(), user.c_str(), passwd.c_str(), port);
-
             const mysqlpp::StoreQueryResult res =
-                conn.query("SELECT fSourceName, fRightAscension, fDeclination FROM source").store();
+                Database(fDatabase).query("SELECT fSourceName, fRightAscension, fDeclination FROM source").store();
 
             out  << HTML::kWhite << '\t';
