Connected to database and checked for connection errors