| title | Creating a Valid Connection String Using Shared Memory Protocol | Microsoft Docs | ||
|---|---|---|---|
| ms.custom | |||
| ms.date | 03/14/2017 | ||
| ms.prod | sql-server-2016 | ||
| ms.reviewer | |||
| ms.suite | |||
| ms.technology |
|
||
| ms.tgt_pltfrm | |||
| ms.topic | article | ||
| helpviewer_keywords |
|
||
| ms.assetid | 5fff42e8-377f-4b40-b0c8-b02393f8a1af | ||
| caps.latest.revision | 25 | ||
| author | BYHAM | ||
| ms.author | rickbyh | ||
| manager | jhubbard |
Connections to [!INCLUDEmsCoName] [!INCLUDEssNoVersion] from a client running on the same computer use the shared memory protocol. Shared memory has no configurable properties. Shared memory is always tried first, and cannot be moved from the top position of the Enabled Protocols list in the Client Protocols Properties list. The Shared Memory protocol can be disabled, which is useful when troubleshooting one of the other protocols.
You cannot create an alias using the shared memory protocol, but if shared memory is enabled, then connecting to the [!INCLUDEssDE] by name, creates a shared memory connection. A shared memory connection string uses the format lpc:<servername>[\instancename].
When connecting to [!INCLUDEssNoVersion] running on the same computer as the client, you can use (local) as the server name. This is not encouraged as it leads to ambiguity, however it can be useful when the client is known to be running on the intended computer. For instance, when creating an application for mobile disconnected users, such as a sales force, where [!INCLUDEssNoVersion] will run on laptop computers and store project data, a client connecting to (local) would always connect to the [!INCLUDEssNoVersion] running on the laptop. The word localhost or a period (.) can be used in place of (local).
The following query will return the protocol used for the current connection.
SELECT net_transport
FROM sys.dm_exec_connections
WHERE session_id = @@SPID;
The following names will connect to the local computer with the shared memory protocol if it is enabled:
<servername>
<servername>\<instancename>
(local)
localhost
You cannot create an alias for a shared memory connection.
Note
Specifying an IP Address in the Server box will result in a TCP/IP connection.
Creating a Valid Connection String Using TCP IP
Creating a Valid Connection String Using Named Pipes
Choosing a Network Protocol