connecting map to db