How to fix Error 4801 on Windows Server 2025 / Windows 11

Why This Error Happens

This error occurs because the SQL Server Bulk Copy Program (BCP) API and INSERT BULK operations require a direct TCP/IP connection to the Database Engine, but the client session is currently routed through Named Pipes or Shared Memory protocol. SQL Server 2025 restricts bulk rowset operations to TCP/IP because the bulk load protocol extension relies on packet-level features that Named Pipes cannot negotiate correctly. This typically surfaces when a connection string, DSN, or driver configuration explicitly forces a non-TCP protocol, or when the SQL Server Configuration Manager has TCP/IP disabled while Named Pipes remains enabled as the default.

Step-by-Step Resolution Guide

Step 1: Verify Enabled Protocols in SQL Server Configuration Manager

  • Open SQL Server Configuration Manager (sqlservermanager16.msc for SQL Server 2025).
  • Navigate to SQL Server Network Configuration > Protocols for MSSQLSERVER (or your instance name).
  • Confirm that TCP/IP is set to Enabled.
  • If Named Pipes is Enabled and listed above TCP/IP in client protocol order, this is likely forcing the bulk operation over the wrong channel.

Step 2: Force the Client Connection to Use TCP/IP

  • Open SQL Server Configuration Manager > SQL Native Client 16.0 Configuration > Client Protocols.
  • Right-click TCP/IP and set Enable, then move it above Named Pipes using Order.
  • In your application connection string, explicitly specify the protocol prefix, e.g.:
  • Server=tcp:YourServerName,1433;Database=YourDB;...
  • For ODBC/OLE DB DSNs, open ODBC Data Source Administrator (odbcad32.exe) and confirm “Dynamically determine port” or set port 1433 under the TCP/IP tab.

Step 3: Restart the SQL Server Service and Validate Port Binding

  • After changing protocol settings, restart the service via:
  • services.msc → right-click SQL Server (MSSQLSERVER) → Restart
  • Or run: net stop MSSQLSERVER && net start MSSQLSERVER
  • Confirm TCP port 1433 (or custom port) is listening:
  • netstat -ano | findstr 1433
  • Check Windows Firewall on Windows Server 2025 allows inbound traffic on port 1433 (wf.msc → Inbound Rules → New Rule → Port → TCP 1433).

Step 4: Re-Run the Bulk Insert Operation Over TCP

  • Re-attempt the BULK INSERT, bcp.exe, or SqlBulkCopy operation using a connection string that forces tcp: protocol.
  • Example using bcp:
  • bcp YourDB.dbo.YourTable in data.csv -S tcp:YourServerName,1433 -T -c

Alternative or Verification Steps

  • Run SELECT net_transport FROM sys.dm_exec_connections WHERE session_id = @@SPID; — it should return TCP instead of Named Pipe or Shared Memory.
  • If the error persists after forcing TCP/IP, check if the client driver (ODBC Driver 18, OLE DB Driver) is outdated — update to the latest Microsoft driver release compatible with SQL Server 2025, as older drivers may hardcode Named Pipes for local/loopback connections.