我使用Sqoop 1.4.4将数据从hdfs导出到mysql。 并得到以下错误:
bin/sqoop export --connect jdbc:mysql://127.0.0.1:3306/rec --username root --password root --table rec_temp --export-dir hdfs://127.0.0.1:9000//user/hdfs/part-r-00000 input-lines-terminated-by ' '
14/12/20 17:14:04 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
14/12/20 17:14:04 INFO tool.CodeGenTool: Beginning code generation
14/12/20 17:14:05 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `rec_temp` AS t LIMIT 1
14/12/20 17:14:05 ERROR manager.SqlManager: Error reading from database: java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@76b03b7f 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@76b03b7f 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.
更多信息:
part-r-00000 data:
1 [105:1.1617604]
.....
mysql> describe rec_temp;
+-----------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------+------+-----+---------+-------+
| user_id | int(11) | NO | PRI | NULL | |
| rec_value | text | YES | | NULL | |
+-----------+---------+------+-----+---------+-------+
你可以帮我解决这个问题吗?谢谢!
答案 0 :(得分:2)
sqoop报告here中存在类似的错误。请验证您正在使用的正确的MySQL连接器版本和sqoop版本,并根据需要更新版本。希望这可以解决您的问题。感谢。
答案 1 :(得分:0)
尝试使用另一个mysql驱动程序版本,如@Sachin所说。
它不是sqoop-1.6.1 + mysql-connector-java-5.0.8.tar的工作者,但是当我改为mysql-connector-java-5.1.17.jar
答案 2 :(得分:0)
添加--driver com.mysql.jdbc.Driver --direct 例如,这对我有用:
sqoop export --connect jdbc:mysql://sandbox.hortonworks.com:3306/retail_db --username retail_dba --password hadoop --driver com.mysql.jdbc.Driver --direct --export-dir /user/horton/weather --table weather