'np:' and '\pipe\' Explained: A Guide for Access Developers

You've just inherited a legacy Access application and spotted something unusual in the connection string.

The connection string contains unfamiliar elements like 'np:' or '\pipe\', and you're not quite sure what to make of them. These are indicators of Named Pipes, a protocol that's been around since the early days of SQL Server. Many Access developers go their entire careers without encountering Named Pipes, but when you do, it's important to understand what you're looking at.

Let's explore what Named Pipes are, how to identify them, and what you need to know when you encounter them in the wild.

What Named Pipes Are

Named Pipes are a Windows communication protocol that predates modern networking standards.

They provide a way for processes to communicate on the same computer or across a network, much like a physical pipe carries water from one location to another. Named Pipes were one of the original methods for connecting to SQL Server, and they're still supported in modern versions. While they're less common today, you'll often find them in older applications or specific network configurations.

These connections are particularly efficient for same-machine communications, which is why they were popular in the early days of client-server applications.

Identifying Named Pipes in Connection Strings

There's a telltale signature when Named Pipes are in use.

Named Pipes can appear in your connection strings in two distinct formats. The first uses the 'np:' prefix, while the second uses the 'Network=DBNMPNTW' parameter. Here are examples of both:

Provider=SQLNCLI11;Server=np:\\ServerName\pipe\sql\query;Database=MyDB;
Provider=SQLNCLI11;Network=DBNMPNTW;Server=ServerName;Database=MyDB;

These formats serve the same purpose but emerged during different eras of SQL Server connectivity.

Understanding UNC vs Named Pipe Paths

Don't confuse Named Pipes with UNC paths - they may look similar, but they're quite different.

A UNC path for file sharing looks like this: \\ServerName\ShareName. While a Named Pipe path looks similar: np:\\ServerName\pipe\sql\query, they serve entirely different purposes. UNC paths access file shares, while Named Pipe paths establish a direct communication channel with SQL Server.

The similarity in syntax often causes confusion among developers encountering Named Pipes for the first time. (I may or may not have spent several hours recently trying to recreate a client environment using my trick for creating UNC aliases for local folders, only to find out the hard way that Windows won't let you create a folder share named "pipe".)

Remember: if you see np: or \pipe\ in the path, you're looking at a Named Pipe, not a file share.

Common Scenarios Where You'll Encounter Named Pipes

Legacy applications are the most likely place you'll find Named Pipes.

Many applications built in the late 1990s or early 2000s defaulted to Named Pipes for SQL Server connectivity. This is especially true for Access Data Projects (.adp files), which were Microsoft's recommended solution for creating SQL Server front-ends between 2000 and 2013. ADP projects often defaulted to Named Pipes because they provided better performance for the direct SQL Server connection that ADPs required.

The tight integration between ADPs and SQL Server made Named Pipes an ideal choice because:

  • They offered lower network overhead than TCP/IP
  • They provided better performance for frequent small queries
  • They handled connection pooling more efficiently
  • They were more secure for internal network communications

You might also encounter Named Pipes in internal network applications where security policies restrict TCP/IP communications. Some organizations specifically configure their networks to use Named Pipes for internal communications while reserving TCP/IP for external connections.

These configurations are less common today but understanding them is crucial when maintaining older systems.

Troubleshooting Named Pipes Connections

When trying to run a legacy application locally, Named Pipes connections often fail with cryptic error messages.

Common error messages include "Named Pipes Provider: Could not open a connection to SQL Server" or "SQL Server does not exist or access denied." Here's a systematic approach to troubleshooting these issues in your development environment:

Basic Configuration Checks

  • Ensure Named Pipes protocol is enabled in SQL Server Configuration Manager
  • Verify the SQL Server Browser service is running
  • Check that your SQL Server instance allows Named Pipes connections
  • Confirm your Windows account has appropriate SQL Server permissions

Handling Server Name Mismatches

Found a hardcoded server name in your connection string that doesn't match your dev environment? Here's a developer-friendly workaround:

  1. Open your hosts file (usually located at C:\Windows\System32\drivers\etc\hosts)
  2. Add an entry mapping the original server name to localhost:
127.0.0.1    OLDSERVERNAME
  1. This redirects all calls to 'OLDSERVERNAME' to your local SQL Server instance

Common Development Environment Issues

  • If using np:\ServerName\pipe\sql\query format, try switching to np:\.\pipe\sql\query for local connections
  • For local testing, Network=DBNMPNTW;Server=(local) often works better than a named server
  • Remember that Named Pipes uses port 445 if you're running through a local firewall
  • Consider temporarily disabling your firewall while testing to eliminate it as a source of problems

The key is to get the application running locally first, then worry about optimizing the connection method later.

Referenced Articles

UNC Alias for a Local Folder
The subst command lets us mimic mapped network drives. But what if your backend tables are linked using UNC paths? Don’t worry. We can handle those, too!

Further Reading

Lesson Learned #472:Why It’s Important to Add the TCP Protocol When Connecting to Azure SQL Database | Microsoft Community Hub
In certain service requests, our customers encounter the following error while connecting to the database, similar like this one: “Connection failed:…

Acknowledgements
  • Article title generated with the help of Claude-3.5-Sonnet
  • Article excerpt generated with the help of Claude-3.5-Sonnet
  • Initial draft generated with the help of Claude-3.5-Sonnet
  • Cover image generated by FLUX-dev