refactor dbaccess & add init.d file