Externalizing database access to a service