method to getConnection without using hibernate