'How to change the hostname for the SQL server?

I moved a system 'asp.net' to another server and now I need to change the hostname for the SQL server, but the <connectionStrings/>(web.config) is empty, where should I change?



Solution 1:[1]

It has to be somewhere or it would never have worked. You can grep/search for the connection string in your code, or you didn't actually move the config file.

Solution 2:[2]

You will need to change connection strings whereever they are present.

They might have been added in the appSettings section, or for state using SQL Server in the sessionState section.

It is possible that the connection strings have been put into a config file of their own - does the connectionStrings section have a configSource attribute? If so, that's where they would be found.

It is easy enough to search for Initial Catalog= or Server= within your config files.

Solution 3:[3]

If you have access to the code, then fire up notepad++ like editor and find the sqlconnection object.. there you will have the connection string or reading mechanism employed.

Solution 4:[4]

You might be able to do the following for a quick fix.

Modify the hosts file to point the old server name to the new IP address. This should work, unless the connection string has an IP address in it.

Also, you should check with other software to make sure the new database server is running properly. Just to be sure it's the application having the problem, and not the server.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Steve Wellens
Solution 2 Oded
Solution 3 Saravanan
Solution 4 Dan Williams