I am trying to understand the differences between the following 2 connectionstrings.
one uses servername\instancename and the other one uses the server ip address.
Can I specify port number for “serverName\instanceName”.
I know you can specify port number for ip address, something like ‘10.0.0.1,xxx’.
thanks,
Server=myServerName\theInstanceName;Database=myDataBase;Trusted_Connection=True;
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
Quite briefly:
if you have just
server=(machinename)orserver=(ipaddress)then you’re connecting to the default instance of SQL Server on that machine (no name for the instance)if you have
server=(machinename)\InstanceName, then you’re connecting to a named instance of SQL Server on that machineEach physical server machine can have one default instance of SQL Server, and any number of named instances (names must be different, obviously).
To connect to a named instance and specify a non-standard port, use this syntax here:
or
where the xxxx stands for the port you want to use.