Managing database connections using APIs