Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Why Sqoop Executing same query for both MySql and Oracle..

avatar
Expert Contributor

sqoop import --driver oracle.jdbc.driver.OracleDriver --connect jdbc:oracle:thin:@ipaddress:1521:orcl --username username --password password --table T_PROJECT --delete-target-dir --warehouse-dir /foo

The above one is simple sqoop command i executed.This tries to execute following command to know the columns."SELECT t.* FROM T_PROJECT AS t WHERE 1=0" (False condition to know columns of table) .Unfortunately this won't work in oracle.If i changed the database to mysql,It is working well.Where is the logic.How to execute above command for oracle database.

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Suresh Bonam

Skip --driver oracle.jdbc.driver.OracleDriver - Bug

Run this

sqoop import --connect jdbc:oracle:thin:@ipaddress:1521:orcl --username username --password password --table T_PROJECT --delete-target-dir --warehouse-dir /foo

View solution in original post

7 REPLIES 7

avatar
Master Mentor
@Suresh Bonam

Please share the output of sqoop while running it for oracle. I have never experienced any issues while running simple import from oracle to hive using sqoop.

I don't have oracle instance running but you can see working example here

http://www.rittmanmead.com/2014/03/using-sqoop-for...

avatar
Expert Contributor

HI Neeraj,

The following pic shows the error.The respective command is as i wrote in the question only with -m 1 option.The oracle imports are working well with query.But i try to import data using --table option instead of --query there i am getting error.This command is working fine with Mysql. I taught Sqoop using select t.* from T_PROJECT as t where 1=0 to determine column names,there oracle database suffers.And it is executing well in Mysql.

807-error-with-oracle-in-sqoop.png

avatar
Master Mentor

@Suresh Bonam The problem is with "AS" operator Bug

What is the ojdbc version?

avatar
Expert Contributor
@Neeraj Sabharwal

The ojdbc version is 14. How to solve it??

avatar
Master Mentor

@Suresh Bonam

Skip --driver oracle.jdbc.driver.OracleDriver - Bug

Run this

sqoop import --connect jdbc:oracle:thin:@ipaddress:1521:orcl --username username --password password --table T_PROJECT --delete-target-dir --warehouse-dir /foo

avatar
Master Mentor

@Suresh Bonam Did it work? If yes then please accept the answer for future reference.

avatar
Expert Contributor

Yupp..its working fine...Tq