问题-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. 微信小程序开发入门与实践

    基础知识---- MINA 框架 为方便微信小程序开发,微信为小程序提供了 MINA 框架,这套框架集成了大量的原生组件以及 API.通过这套框架,我们可以方便快捷的完成相关的小程序开发工作. MIN ...

  2. 批量Ping执行Bash脚本

    #!/bin/bash # Ping Batch Script # 连接超时时间 TMOUT= # 最大线程数 MAX_THREAD= # 保留内存大小 MIN_MEM= # 默认ip配置,可通过 - ...

  3. 机器学习改善Interpretability的几个技术

    改善机器学习可解释性的技术和方法 尽管透明性和道德问题对于现场的数据科学家来说可能是抽象的,但实际上,可以做一些实际的事情来提高算法的可解释性 算法概括 首先是提高概括性.这听起来很简单,但并非那么简 ...

  4. Mysql的Event

    Mysql的Event Event简介 Event是mysql中的一个事件,和触发器类似,触发器是在某条sql语句执行后可能会触发,而Event是每隔一段时间或某个特定的时间点执行,可以精确到秒. 准 ...

  5. Java ----单个list 删除元素

    转载:https://www.cnblogs.com/lostyears/p/8809336.html 方式一:使用Iterator的remove()方法 public class Test { pu ...

  6. Java初识方法

    5.初识方法 方法就是一段代码片段,这个片段可以完成特定的功能,并且可以重复利用. 5.1 方法的定义 5.1.1方法的定义格式 [方法修饰列表] 返回值类型 方法名(方法参数列表){ 方法体 } ① ...

  7. Nginx的动静分离

    Nginx的动静分离 在之前我们的负载均衡中,我们再jsp中设置了一个背景,这是一个静态资源,Tomcat处理静态资源的效率并没有Nginx高,我们可以通过动静分离将静态资源和动态资源分割开来,Tom ...

  8. noip 2014 总结

    2014 年的noip 已经结束了,成绩从个人而言不是特别的理想,从今年题的逗的程度,本来是个xxx 就被玩脱了= = 当然现在后悔事没有用的了,不过第二天全屏技术的在最后一小时看到了两道题的错误,然 ...

  9. NX二次开发-如何判断孔特征和边倒圆是否在凸台特征后面?

    在建模的时候,部件导航器里的特征按建模顺序是有特征时间戳记的. 我们可以根据特征时间戳记的名字来判断哪个特征在前,哪个在后. #include <uf.h> #include <uf ...

  10. PostgreSQL/GREENPLUM关联更新

    update a_t AA set /*AA.*/ sqlstr = 'qqq' from a_t BB where aa.id <> BB.id and aa.name = BB.nam ...