packaged and refactored code to unify mysql and HSQL DB connections