refine the srv_main and db code

refine the srv_main and db code