Fix database connection in test