Should a Connection String include a local instance or IP Address

Viewed 26

We are optimizing our Web System and I then had a thought.

In the web system's Web.config, should the connection string include an IP Address to the local SQL Server or rather an Instance? Will there be a performance difference?

I was thinking that with an IP address a formal IP or TCP connection would be established and perhaps with a local Instance reference a different protocol is executed?

I couldn't find related information on the web.

1 Answers

Using an instance name such as SomeMachine\SomeInstance means the client needs to look up the port using SQL Browser.

For best performance it would probably be best to use an IP address and port number. You must set a static port for the instance, otherwise it won't connect.

Ideally use a DNS name rather than an IP address, otherwise you keep having to change it. So you want something like SomeMachineDnsName.YourDomain.com,1433.

Related