adding reconnect before sql queries to solve wait_timeout issue