lesson11:refactor duplicated code for jdbc