Fixing an issue with SQL connections