zoukankan      html  css  js  c++  java
  • 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:

    • In SSMS the network protocol is default. I don't have a local SQL Server. May it be that I need to enable trust server certificate? – chhenning Nov 18 '16 at 3:10 
    • You should have SQL Server client tools on this machine, otherwise how the bcp.exe appeared there, in the first place? And no, this doesn't look like a certificated-related issue. – Roger Wolf Nov 18 '16 at 9:47
    •  
      Finally got SQL Server Configuration Manger to run. The order is Shared Memory (1), TCP/IP (2), and Named Pipes (3). Still, even when I disable Named Pipes I get the same error message. – chhenning Nov 19 '16 at 3:48
    •  
      Put TCP/IP into first position. Also, note that there are 2 separate client configurations, for 32-bit and 64-bit clients, and I'm not sure which one bcp uses. Make sure you have set both of them properly. – Roger Wolf Nov 19 '16 at 4:17

    扩展-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

     

  • 相关阅读:
    【作业】Python
    【作业】判断某个数是否是素数,返回结果
    【案例】Python之列表反转
    Python模块
    【作业】Python-数据转换:将列表["mo","deng","ge"]和[1,2,3] 转换成[("mo",1),("deng",2),("ge",3)]
    【个人笔记】Python-zip()函数
    【作业】Python-数据转换:将列表[3,7,0,5,1,8]中大于5元素置为0,小于5的元素置为1
    【作业】Python-将元组(1,2,3) 和集合{"four",5,6}合成一个列表
    【作业】Python-函数封装:交换两个变量的值
    【个人笔记】Python-sorted()函数
  • 原文地址:https://www.cnblogs.com/frankcui/p/10967177.html
Copyright © 2011-2022 走看看