Move database connection into main window class