Anna
Anna

Reputation: 261

Sqoop export error

I use the Sqoop 1.4.4 to export data from hdfs into mysql. And got the following error:

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.

More information:

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    |       |
+-----------+---------+------+-----+---------+-------+

Can you help me fix this? Thanks!

Upvotes: 1

Views: 1405

Answers (3)

Manav Patadia
Manav Patadia

Reputation: 884

Add --driver com.mysql.jdbc.Driver --direct For example, this works for me:

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

Upvotes: 0

zhen lee
zhen lee

Reputation: 333

Try to use another mysql driver version as @Sachin said.

It doesnt't worker with sqoop-1.6.1 + mysql-connector-java-5.0.8.tar, but works fine when I change to mysql-connector-java-5.1.17.jar

Upvotes: 0

Sachin Janani
Sachin Janani

Reputation: 1319

There is a similar bug in sqoop reported here .Please verify the correct MySQL connector version and sqoop version that you are using and update the version as required.Hope this will solve your problem. Thanks.

Upvotes: 2

Related Questions