implement the db connection code,rpc code