Friday 4 September 2009

Daily Code Notes

Daily Code Notes

http://dailycodenotes.blogspot.com/

1 comment:

  1. Sample code with SQL Server connection strings often use localhost and (local) interchangeably. They're different.

    1)Server=(local);Database=DotNetNuke;Trusted_Connection=True

    Uses named pipes

    2)Server=localhost;Database=DotNetNuke;Trusted_Connection=True

    Uses a TCP port negotiated on port 1434 udp, which defaults to 1433

    >>> There are many differences between TCP and Named Pipe connection, but if you're on localhost you're mostly concerned with simple access.

    * The default ASPNET account generally has an easier time with TCP, since the ASPNET user doesn't have access to named pipes by default (http://support.microsoft.com/Default.aspx?id=315159).
    * If you're using impersonation, Named Pipes is usually simpler. If you're using impersonation with no username specified, you're running under the IIS Authenticating user. This defaults to IUSR_MACHINENAME if you're allowing annonymous access, which generally has access to the IPC$ share required for named pipe communications.

    Server="machine_name" uses TCP Connection.

    Also, keep in mind, there is a performance hit for using named pipes. Named pipes are backed by disk, and too much named pipes usage may cause disk i/o to spike. Combine this with the fact that database servers by nature are disk i/o intensive, it may be better to offload the communication activity to network i/o through the use of TCP.

    "All I know is that localhost uses TCPIP while (local) and . use a protocol called shared memory and does not use any network protocols."

    According to MSDN, (local) and localhost are the same; both user Shared Memory protocol.

    ReplyDelete