从 SQL Server 2008 导入 sqoop

Posted

技术标签:

【中文标题】从 SQL Server 2008 导入 sqoop【英文标题】:sqoop import from SQL server 2008 【发布时间】:2013-09-26 11:53:05 【问题描述】:

我正在尝试通过 SQOOP 连接 SQL Server,但出现以下错误:

sqoop import --connect 'jdbc:sqlserver://localhost:1433;username=kashif;password=sqoop;database=Northwind' --table Department -m 1;
13/09/26 04:41:22 INFO SqlServer.MSSQLServerManagerFactory: Using Microsoft's SQL Server - Hadoop Connector
13/09/26 04:41:22 INFO manager.SqlManager: Using default fetchSize of 1000
13/09/26 04:41:22 INFO tool.CodeGenTool: Beginning code generation
13/09/26 04:41:37 ERROR manager.SqlManager: Error executing statement: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".

我已经下载了 sqoop sql 连接器并将它也放在 /usr/lib/sqoop/lib 文件夹中。

我还检查了端口 1433 是否已启用 TCP 连接。

你能指导我吗?

【问题讨论】:

【参考方案1】:

试试这个,替换必要的ip userid pwd和db等,

sqoop import --connect "jdbc:sqlserver://123.23.231.2;database=mydb" --username sa --password sa --driver com.microsoft.sqlserver.jdbc.SQLServerDriver --table "mytable' - -target-dir "/tmp/mytable'

【讨论】:

以上是关于从 SQL Server 2008 导入 sqoop的主要内容,如果未能解决你的问题,请参考以下文章

从 excel 导入数据时防止 SQL Server 2008 中的行重复

自动将 CSV 导入 SQL Server 2008 R2

SQL server 2008中使用SSIS从一个数据库导入数据到另一个数据库,[SQL Server 目标 [22]] 错误: 无法准备 S

SQL Server:从 .mdf 导入数据库?

SQL SERVER 2008 R2 数据库附加到 SQL server 2005,怎么整

从 SQL Server Management Studio 2008 运行 SSIS 包