refactored sql connection to use pool