adding support for reconnection when mysql close connection