Sqoop import problem with mysql

I have hadoop ha setting based on cdh5.I tried to import tables from mysql using sqoop, with an error.

15/03/20 12:47:53 ERROR manager.SqlManager: Error reading from database: java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@33573e93 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@33573e93 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. 

I used the command below.

 sqoop import --connect jdbc:mysql://<mysql hostname>:3306/haddata --username root --password password --table authors --hive-import 

My mysql server version is 5.1.73-3. and used 5.1.34 and 5.1.17 version of mysql-connector-java

 sqoop version is 1.4.5-cdh5.3.2 

Please let me know any suggestions / comments.

+5
source share
9 answers

Try including the --driver com.mysql.jdbc.Driver option in the import command.

+24
source

Try using the command below that may suit your purpose

 sqoop import --connect jdbc:mysql://<mysql hostname>:3306/haddata --driver com.mysql.jdbc.Driver --username root --password password --table authors --hive-import 
+8
source

follow this link

Include the --driver com.mysql.jdbc.Driver driver argument in the sqoop command.

sqoop import --connect jdbc:mysql://<mysql hostname>:3306/<db name> --username **** --password **** --table <table name> --hive-import --driver com.mysql.jdbc.Driver

The --driver parameter forces sqoop to use the latest mysql-connector-java.jar installed for mysql db on the sqoop machine

+6
source

Try it with mysql-connector-java-5.1.31.jar, it is compatible with sqoop 1.4.5.

The mysql-connector-java-5.1.17.jar driver does not work with sqoop 1.4.5.

:

https://issues.apache.org/jira/browse/SQOOP-1400

+2
source

If you have com.mysql.jdbc_5.1.5.jar or any version of com.mysql.jdbc_5.XXjar in the $ HADOOP_HOME / bin folder, delete it and run the SQOOP query.

0
source

including the --driver com.mysql.jdbc.Driver parameter in the import command that worked for me.

0
source

Sqoop does not ship with third-party JDBC drivers. You must download them separately and save them in the / var / lib / sqoop / directory on the server.

Note: JDBC drivers only need to be installed on the machine where Sqoop is running. You do not need to install them on all hosts in your Hadoop cluster.

You can download the driver here: https://dev.mysql.com/downloads/connector/j/5.1.html

0
source

Try the exact command as shown below.

sqoop import --connect "jdbc: mysql: // localhost: 3306 / books" --username = root --password = root --table authors --as-textfile --target-dir = / datasqoop / authors_db --columns "id, name, email" --split-by id --driver com. mysql.jdbc.Driver

This will solve your problems.

0
source

Find the locations of the banners used in sqoop, in my case it points to the link / usr / share / java / mysql -connector-java.jar

so when I check the link / usr / share / java / mysql -connector-java.jar, it points to mysql-connector-java- 5.1.17 .jar

/usr/share/java/mysql-connector-java.jar → mysql-connector-java-5.1.17.jar

since 5.1.17 has this problem, try 5.1.37 or higher .

unlink / usr / share / java / mysql-connector-java.jar

ln -s / usr / share / java / mysql-connector-java.jar / usr / share / java / mysql-connector-java-5.1.37.jar

0
source

Source: https://habr.com/ru/post/1215734/


All Articles