问题-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 [].
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

SQL Server - SQL Server/ bcp 工具如何通信的更多相关文章

  1. sql server 内置ETL工具学习(一) BCP篇

    sql server 内置ETL工具学习 常用的导入方式:bcp, BULK INSERT,OPENROWSET和 SSIS. BCP BCP全称BULK COPY PROGRAM 有以下特点: 命令 ...

  2. Sql server 2008 R2 配置管理工具服务显示远程过程调用失败:0x800706be

    Sql server 2008 R2 配置管理工具服务显示远程过程调用失败:0x800706be   今天在其他电脑配置 SQl server 2008 R2,安装完成后,发现打开配置管理工具服务 : ...

  3. SQL server经典电子书、工具和视频教程汇总

    SQL server经典电子书.工具和视频教程汇总 SQL server经典电子书.工具和视频教程汇总 SQL Server是高校计算机专业的一门必修课程,同时众多企业采用SQL Server作为数据 ...

  4. 安装 SQL Server 2008 和管理工具 SQL Server 2008 management studio 及相关问题解决

    Sql Server 2008 问题小总结 http://www.lihengyu.com/blog/4877.html 安装 SQL Server 2008 和管理工具 SQL Server 200 ...

  5. Sql性能检测工具:Sql server profiler和优化工具:Database Engine Tuning Advisor

    原文:Sql性能检测工具:Sql server profiler和优化工具:Database Engine Tuning Advisor 一.工具概要     数据库应用系统性能低下,需要对其进行优化 ...

  6. 服务器文档下载zip格式 SQL Server SQL分页查询 C#过滤html标签 EF 延时加载与死锁 在JS方法中返回多个值的三种方法(转载) IEnumerable,ICollection,IList接口问题 不吹不擂,你想要的Python面试都在这里了【315+道题】 基于mvc三层架构和ajax技术实现最简单的文件上传 事件管理

    服务器文档下载zip格式   刚好这次项目中遇到了这个东西,就来弄一下,挺简单的,但是前台调用的时候弄错了,浪费了大半天的时间,本人也是菜鸟一枚.开始吧.(MVC的) @using Rattan.Co ...

  7. C#构造方法(函数) C#方法重载 C#字段和属性 MUI实现上拉加载和下拉刷新 SVN常用功能介绍(二) SVN常用功能介绍(一) ASP.NET常用内置对象之——Server sql server——子查询 C#接口 字符串的本质 AJAX原生JavaScript写法

    C#构造方法(函数)   一.概括 1.通常创建一个对象的方法如图: 通过  Student tom = new Student(); 创建tom对象,这种创建实例的形式被称为构造方法. 简述:用来初 ...

  8. SQL Server SQL性能优化之--通过拆分SQL提高执行效率,以及性能高低背后的原因

    复杂SQL拆分优化 拆分SQL是性能优化一种非常有效的方法之一, 具体就是将复杂的SQL按照一定的逻辑逐步分解成简单的SQL,借助临时表,最后执行一个等价的逻辑,已达到高效执行的目的 一直想写一遍通过 ...

  9. SQL Server SQL分页查询

    SQL Server SQL分页查询的几种方式 目录 0.    序言 1.    TOP…NOT IN… 2.    ROW_NUMBER() 3.    OFFSET…FETCH 4.    执行 ...

随机推荐

  1. 巧用border属性

    border是常见的css2属性,大家的印象中是不是只是作为边框使用,如下所示: 事实上border,还可以当做图标去使用 我们先来看段代码 <style> .div1{ margin: ...

  2. json传参报错

    restful接口报错: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('e' (code 101)): w ...

  3. pytest的断言、跳过、运行的按需要处理

    def test_one(): assert 1==1 assert 1!=2 assert {'name':'linda','age':19}=={'name':'linda','age':190} ...

  4. jp@gc - Stepping Thread Group (deprecated)

      并发6个用户,线程之前不等待,每隔3秒增加1个用户,间隔时间是2秒,然后并发数增加完成之后,运行60秒,运行完成后,每1秒钟停止2个用户

  5. 通过反射来创建对象?getConstructor()和getDeclaredConstructor()区别?

    1. 通过类对象调用newInstance()方法,适用于无参构造方法: 例如:String.class.newInstance() public class Solution { public st ...

  6. 快速读取 C++

    int read() { ; ; char ch=getchar(); ') { if (ch=='-') f=-; ch=getchar(); } ') { x=x*+ch-'; ch=getcha ...

  7. (PASS)字符数组\字符串数组 和 字符串 的相互转换

    1,字符数组 转换为 字符串 java可以使用两种方法直接将字符数组转为字符串. 方法1:直接在构造String时转换. char[] data = {'a', 'b', 'c'}; String s ...

  8. Django -- 高级知识点

    Django -- 高级知识点 高级知识点包括: 静态文件处理 中间件 上传图片 Admin站点 分页 使用jquery完成ajax 管理静态文件 项目中的CSS.图片.js都是静态文件 配置静态文件 ...

  9. thinkphp 数据缓存

    在ThinkPHP中进行缓存操作,一般情况下并不需要直接操作缓存类,因为系统内置对缓存操作进行了封装,直接采用S方法即可,例如: 缓存初始化 // 缓存初始化 S(array('type'=>' ...

  10. NX二次开发-直线分析函数UF_EVAL_ask_line与NXOpen::Line直线分析的用法

    NX11+VS2013 #include <NXOpen/Line.hxx> #include <NXOpen/NXException.hxx> #include <NX ...