Aracılığıyla paylaş


Adlandırılmış yöneltme kullanarak bir geçerli bağlantı dizesi oluşturma

Unless changed by the user, when the default instance of Microsoft SQL Server listens on the named pipes protocol, it uses \\. \pipe\sql\query as the pipe name.The period indicates that the computer is the local computer, pipe indicates that the connection is a named pipe, and sql\query is the name of the pipe.To connect to the default pipe, the alias must have \\<computer_name>\pipe\sql\query as the pipe name.If SQL Server has been configured to listen on a different pipe, the pipe name must use that pipe.For instance, if SQL Server is using \\. \pipe\unit\app as the pipe, the alias must use \\<computer_name>\pipe\unit\app as the pipe name.

Geçerli kanal adı oluşturmak için şunları yapmalısınız:

  • Belirttiğiniz bir diğer adı.

  • Seçin adlı kanallar olarak protokol.

  • Girin kanal adı.Alternatif olarak, bırakın Kanal adı boş ve SQL Server Configuration Manager tamamlanma uygun kanal adı belirtin, sonra protokol ve Server

  • Belirttiğiniz bir Server.Adlandırılmış bir örneği için bir sunucu adı ve adlandırılmış örnek sağlayabilirsiniz.

At the time of connection, the SQL Server Native Client component reads the server, protocol, and pipe name values from the registry for the specified alias name, and creates a pipe name in the format np:\\<computer_name>\pipe\<pipename> or np:\\<IPAddress>\pipe\<pipename>. For a named instance, the default pipe name is \\<computer_name>\pipe\MSSQL$<instance_name>\sql\query.

Not

Microsoft Windows xp Service Pack 2 güvenlik duvarı Windows varsayılan olarak bağlantı noktası 445'i kapatır, güvenlik sağlar.Because Microsoft SQL Server communicates over port 445, you must reopen the port if SQL Server is configured to listen for incoming client connections using named pipes.Bir Güvenlik Duvarı'nı yapılandırma hakkında bilgi için bkz: "How to: Bir Güvenlik Duvarı'nı sql Server erişimi için yapılandırma" de SQL Server Çevrimiçi Kitapları veya gözden sizin güvenlik duvarı belgelerine.

Yerel sunucuya bağlanma

When connecting to SQL Server running on the same computer as the client, you can use (local) as the server name.Kullanarak (local) değil teşvik çünkü Liderleri belirsizlik; Ancak hedeflenen bilgisayarda çalışıyor olması için istemci bilindiğinde yararlı olabilir.İçin örnek, bir satış ekibi gibi mobil bağlantısı kesilen kullanıcıların bir uygulama oluştururken, burada SQL Server veri dizüstü bilgisayarlar ve mağaza proje üzerinde çalışacak, (local) bağlanan bir istemci her zaman bağlanmak SQL Server çalışan dizüstü bilgisayar.Word localhost veya yerine nokta (.) kullanılabilir (local).

Bilgisayarınızın bağlantı protokolü doğrulanıyor

Geçerli bağlantı için kullanılan protokol aşağıdaki sorgu döndürür.

SELECT net_transport 
FROM sys.dm_exec_connections 
WHERE session_id = @@SPID;

Örnekler

Sunucu adı varsayılan kanala göre bağlanma:

Alias Name         <serveralias>
Pipe Name          <blank>
Protocol           Named Pipes
Server             <servername>

IP adresine göre varsayılan kanala bağlanma:

Alias Name         <serveralias>
Pipe Name          <leave blank>
Protocol           Named Pipes
Server             <IPAddress>

Sunucu adı varsayılan olmayan kanala göre bağlanma:

Alias Name         <serveralias>
Pipe Name          \\<servername>\pipe\unit\app
Protocol           Named Pipes
Server             <servername>

Adlandırılmış örnek için sunucu adı tarafından bağlanma:

Alias Name         <serveralias>
Pipe Name          \\<servername>\pipe\MSSQL$<instancename>\SQL\query
Protocol           Named Pipes
Server             <servername>

Yerel bilgisayar kullanarak bağlanma localhost:

Alias Name         <serveralias>
Pipe Name          <blank>
Protocol           Named Pipes
Server             localhost

Bir dönem kullanarak yerel bilgisayara bağlanma:

Alias Name         <serveralias>
Pipe Name          <left blank>
Protocol           Named Pipes
Server             .

Not

Ağ protokol olarak belirtmek için bir sqlcmd parametresi, bkz: "nasıl yapılır: İçin Database Engine kullanma sqlCmd.exe Bağlan" de SQL Server Çevrimiçi Kitapları.