Friday, March 04, 2005 11:12 PM
by
RepeatableRead
Forcing Named-Pipe Connections in SQL Server 2000/2005
Forcing your connections to SQL Server to use Named-Pipes is actually a pretty simple operation. The problem is that it's almost a secret how to do it as so few people are acquaintd with how to do it. (Forcing it can sometimes be helpfull if you are trying to troubleshoot/diagnose connection issues, or if you are trying to force it for firewall purposes/etc.)
To force a connection to use Named-Pipes, just append np: before the name of your server. Examples in Query Analyzer (or Profiler) look like:
np:.
np:(local)
np:BigSQL1
Note that you can also append this in .NET connection strings and they work as well: just specify named pipes in the connection
string for the source and you're good to go, like so:
// note that I'm not using sa with a null password, instead I'm using integrated security.
string connString = "Data Source=np:(local);Integrated Security=SSPI;Initial Catalog=Northwind;";
Of course, the good news is that you can connect to SQL Server 2005 instances using the same protocol switch (for
example just point Profiler or SQL Server Management Studio at np:. and you'll be able to hook up, forcing the connection over Named-Pipes).