数据库
首页 > 数据库> > SQL Server - SQL Server/ bcp 工具如何通信

SQL Server - SQL Server/ bcp 工具如何通信

作者:互联网

 

问题-BCP通讯

ref: https://stackoverflow.com/questions/40664708/bcp-cannot-connect-to-aws-sql-server-but-ssms-can 

Anyone know a good reason why bcp cannot connect to a sql server hosted by AWS while SSMS can? I have double checked the server and user account details and they both match.

I'm using the generic command to import a csv file:

bcp DB_Name.dbo.Table in "somefile_file.csv" -c -S xxx.rds.amazonaws.com -U username -P xxx -b 1000

The error is:

SQLState = 08001, NativeError = 53
Error = [Microsoft][ODBC Driver 13 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. 
SQLState = 08001, NativeError = 53
Error = [Microsoft][ODBC Driver 13 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
SQLState = S1T00, NativeError = 0
Error = [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired

 

解答-BCP通讯

The first error shows that bcp uses the Named Pipes protocol to connect to the server. Apparently, this protocol is inaccessible for network connections.

On the client workstation where bcp is run, check SQL Server Configuration Manager and ensure that, in the client configuration list TCP/IP is enabled and prioritised. Strangely enough, bcp doesn't have a command line switch for protocol selection, so this is the only way to manage it I can think of.

P.S. Another option is to specify the server address in the form ip_address,port_number, but I don't think you will find this option particularly attractive.

 

Other comments:

 

扩展-SQL Server / BCP通讯协议种类

官方文档--选择网络协议: https://docs.microsoft.com/zh-cn/sql/tools/configuration-manager/choosing-a-network-protocol?view=sql-server-2014

SQL Server中的命名管道(named pipe)及其使用 :https://www.cnblogs.com/chenxizhang/archive/2009/04/23/1441913.html

 

标签:protocol,server,SQL,Nov,Server,bcp
来源: https://www.cnblogs.com/frankcui/p/10967177.html