Search code examples
javamysqlhivesqoop

Unable to import the table from Mysql using Sqoop


I have 5 records in employee table in demo_poc database in MySQL in

192.168.1.126 [Machine-1].

I want to import the data into hive in

192.168.1.129 [Machine-2] using Sqoop.

I Installed sqoop 1.4.6 on Machine-2.

I tried like this,

sqoop import --connect jdbc:mysql://192.168.1.126:3306/demo_poc 
--username root --password root --table employee -m 10
--hive-import --hive-table demo_poc.address

Here is the error I received,

16/04/11 16:28:20 INFO tool.CodeGenTool: Beginning code generation 
16/04/11 16:28:21 ERROR manager.SqlManager: Error executing statement: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 
16/04/11 16:28:21 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: No columns to generate for ClassWriter

Any suggestions. Thanks.


Solution

  • Seems like you are not able to make connection with MySQL.

    Check two things.

    1. Is machine on which MySQL is running accessible?

      try ping 192.168.1.126 command from sqoop machine.

    2. Check Mysql port.

    This question will help you in that.