instantiated connection variable in function