Fixed SQL Re-connect mechanism