def connect(self):
        QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)

        connection_string = 'mysql+mysqldb://{username}:{password}@{host}/{database}'.format(username=USERNAME,
                                                                                             password=PASSWORD,
                                                                                             host=HOST,
                                                                                             database=DATABASE)
        try:
            if self.db is None:
                self.db = DatabaseManager(connectionstring=connection_string, electiondate="2015-10-11")
                self.statusBar().showMessage("Successfully connected to database")
                self.view.actionConnect.setEnabled(False)
                self.view.actionDisconnect.setEnabled(True)
                self.view.actionInsert.setEnabled(True)
                self.view.actionReceive.setEnabled(True)
                self.view.actionCalculate_Predictions.setEnabled(True)
        except:
            QtGui.QMessageBox.critical(self, "Connection Error",  "Error connecting to Database:\n" + sys.exc_info()[0], QMessageBox.Close)

        QtGui.QApplication.restoreOverrideCursor()