Applies to
Symptoms
After the schema cache is refreshed, with a click on the Refresh button under the Schema cache tab, the warning message “Could not connect to server” appears.
Problem
Under the Schema cache tab, when the Refresh button is clicked, the warning message “Could not connect to server <Name of a server>” is shown:
This problem is related to changes of the Windows machine name. For example, when changing Windows machine name from Zivko to John and check SQL Server, you will notice that the old Windows machine name is still present.
Execute the following code in a query editor:
SELECT @@SERVERNAME;
As it can be seen in the image below, the new name of the Windows machine (John) is shown in Object Explorer and the old Windows machine name (Zivko) is shown in the Results grid:
Solution
Use the sp_dropserver procedure over the master database and delete the old SQL Server name (‘ZIVKO\SQLEXPRESS’):
sp_dropserver 'ZIVKO\SQLEXPRESS';
After deleting the old SQL Server name from the master database, the next step is to add a new SQL Server name in the master database (‘JOHN\SQLEXPRESS’) by executing the sp_addserver procedure:
sp_addserver 'JOHN\SQLEXPRESS', 'local';
Now, restart the SQL Server service and check a new SQL Server name:
SELECT @@SERVERNAME;
After all these steps, go to the Schema cache tab of the Options window and click the Refresh button, the warning message will not appear: