refactoring about db connect...