Waits for connection to DB, still need to fix reconnect