a little cleanup and refactoring for common database servlet class