0
votes

When I try to import data from mysql database using sqoop

sqoop import --connect jdbc:mysql://100.107.57.141/mysql --username test -P --query 'SELECT FirstName, Education, Car_Details FROM emp e JOIN emp_test_new etn on e.id=etn.id) WHERE $CONDITIONS' --split-by id  --target-dir /home/join

I am getting below error:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') WHERE (1 = 0)' at line 1

17/08/05 12:04:25 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: No columns to generate for ClassWriter

2
What is in $CONDITIONS? - James Z
Where I have to mention conditions, if I am executing in command prompt? - DevPerson

2 Answers

0
votes

You are missing ( near JOIN ON condition.

Correct sytnatx:

sqoop import --connect jdbc:mysql://100.107.57.141/mysql --username test -P \
--query "SELECT e.FirstName, e.Education, e.Car_Details \
FROM emp e JOIN emp_test_new etn ON (e.id == etn.id) \
WHERE $CONDITIONS' --split-by id  --target-dir /home/join
0
votes
 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: No columns to generate for ClassWriter.

use the below command for the above error:

 --driver com.mysql.jdbc.Driver