用sqoop导入mysql出现错误:
- [jifeng@jifeng02 sqoop]$ bin/sqoop import --connect jdbc:mysql://10.X.X.X:3306/lir --username dss --password 123123 --table bb_month --hive-import -m 100
- Warning: /home/jifeng/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
- Please set $HCAT_HOME to the root of your HCatalog installation.
- Warning: /home/jifeng/sqoop/../accumulo does not exist! Accumulo imports will fail.
- Please set $ACCUMULO_HOME to the root of your Accumulo installation.
- Warning: $HADOOP_HOME is deprecated.
- 14/09/08 01:10:12 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5
- 14/09/08 01:10:12 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
- 14/09/08 01:10:12 INFO tool.BaseSqoopTool: Using Hive-specific delimiters for output. You can override
- 14/09/08 01:10:12 INFO tool.BaseSqoopTool: delimiters with --fields-terminated-by, etc.
- 14/09/08 01:10:12 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
- 14/09/08 01:10:12 INFO tool.CodeGenTool: Beginning code generation
- 14/09/08 01:10:12 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `bb_month` AS t LIMIT 1
- 14/09/08 01:10:12 ERROR manager.SqlManager: Error reading from database: java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@1d5a7f6 is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries.
- java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@1d5a7f6 is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries.
- at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:930)
- at com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(MysqlIO.java:2694)
- at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1868)
- at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
- at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2642)
- at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2571)
- at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1464)
- at com.mysql.jdbc.ConnectionImpl.getMaxBytesPerChar(ConnectionImpl.java:3030)
- at com.mysql.jdbc.Field.getMaxBytesPerCharacter(Field.java:592)
- at com.mysql.jdbc.ResultSetMetaData.getPrecision(ResultSetMetaData.java:444)
- at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:285)
- at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:240)
- at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:226)
- at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:295)
- at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1773)
- at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1578)
- at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:96)
- at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
- at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:601)
- at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
- at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
- at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
- at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
- at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
- at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
- 14/09/08 01:10:12 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: No columns to generate for ClassWriter
- at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1584)
- at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:96)
- at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
- at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:601)
- at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
- at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
- at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
- at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
- at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
- at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
网上搜索是mysql的bug,下载新的jar就可以了
- [jifeng@jifeng02 ~]$ wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.32.tar.gz
- --2014-09-08 01:20:16-- http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.32.tar.gz
- 正在解析主机 dev.mysql.com... 137.254.60.11
- 正在连接 dev.mysql.com|137.254.60.11|:80... 已连接。
- 已发出 HTTP 请求,正在等待回应... 302 Found
- 位置:http://cdn.mysql.com/Downloads/Connector-J/mysql-connector-java-5.1.32.tar.gz [跟随至新的 URL]
- --2014-09-08 01:20:21-- http://cdn.mysql.com/Downloads/Connector-J/mysql-connector-java-5.1.32.tar.gz
- 正在解析主机 cdn.mysql.com... 23.41.85.226
- 正在连接 cdn.mysql.com|23.41.85.226|:80... 已连接。
- 已发出 HTTP 请求,正在等待回应... 200 OK
- 长度:3795067 (3.6M) [application/x-tar-gz]
- 正在保存至: “mysql-connector-java-5.1.32.tar.gz”
- 40% [============================> ] 1,518,632 488K/s eta(英国中部时44% [================================> ] 1,696,736 508K/s eta(英国中部时48% [===================================> ] 1,854,568 523K/s eta(英国中部时54% [=======================================> ] 2,052,944 543K/s eta(英国中部时57% [=========================================> ] 2,186,160 563K/s eta(英国中部时60% [===========================================> ] 2,302,000 572K/s eta(英国中部时63% [=============================================> ] 2,404,808 579K/s eta(英国中部时66% [================================================> ] 2,535,128 590K/s eta(英国中部时70% [==================================================> ] 2,656,760 601K/s eta(英国中部时73% [=====================================================> ] 2,803,008 613K/s eta(英国中部时77% [========================================================> ] 2,939,120 624K/s eta(英国中部时81% [===========================================================> ] 3,104,192 645K/s eta(英国中部时85% [==============================================================> ] 3,257,680 656K/s eta(英国中部时90% [==================================================================> ] 3,437,232 669K/s eta(英国中部时95% [=====================================================================> ] 3,609,544 681K/s eta(英国中部时100%[=========================================================================>] 3,795,067 698K/s in 6.2s
- 2014-09-08 01:20:27 (597 KB/s) - 已保存 “mysql-connector-java-5.1.32.tar.gz” [3795067/3795067])
源地址:http://blog.csdn.net/wind520/article/details/39127843