replace database access with JSON RPC