Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Sqoop import from Sybase to Hive failing when the complete table name is given in the import statement

Solved Go to solution

Sqoop import from Sybase to Hive failing when the complete table name is given in the import statement

Rising Star

Trying to import table data from Sybase table to Hive using the below command:

 sqoop import --verbose  --driver com.sybase.jdbc4.jdbc.SybDriver --connect jdbc:sybase:Tds:dbgbl-tst:8032/DATABASE=trim_bw --username hrongali -P --table trim_bw..account --hive-database trim_bw --hive-table account --hive-import -m 1

Sqoop is generating the below alias(AS trim_bw..account) which is failing to execute in Sybase and the below exception is thrown:

2015-11-17 14:29:48,511 INFO [main] org.apache.sqoop.mapreduce.db.DBRecordReader: Executing query: SELECT col_1, col_2, col_3, col_4 FROM trim_bw..account AS trim_bw..account WHERE ( 1=1 ) AND ( 1=1 )
2015-11-17 14:29:48,514 ERROR [main] org.apache.sqoop.mapreduce.db.DBRecordReader: Top level exception: 
com.sybase.jdbc4.jdbc.SybSQLException: Incorrect syntax near '.'.

	at com.sybase.jdbc4.tds.Tds.processEed(Tds.java:4084)
	at com.sybase.jdbc4.tds.Tds.nextResult(Tds.java:3174)
	at com.sybase.jdbc4.tds.Tds.getResultSetResult(Tds.java:3940)
	at com.sybase.jdbc4.tds.TdsCursor.open(TdsCursor.java:328)
	at com.sybase.jdbc4.jdbc.SybStatement.executeQuery(SybStatement.java:2370)
	at com.sybase.jdbc4.jdbc.SybPreparedStatement.executeQuery(SybPreparedStatement.java:264)
	at org.apache.sqoop.mapreduce.db.DBRecordReader.executeQuery(DBRecordReader.java:111)
	at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:235)

Note: Tried with out giving the database name in the --table parameter, but the table object is not being recognized with that convention

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Sqoop import from Sybase to Hive failing when the complete table name is given in the import statement

@hrongali

I am following stackoverflow link. Can you try this?

sqoop import --verbose --driver com.sybase.jdbc4.jdbc.SybDriver --connect jdbc:sybase:Tds:dbgbl-tst:8032/DATABASE=trim_bw --query "select * from trim_bw..account where \$CONDITIONS" --fields-terminated-by ',' --username hrongali -P --hive-database trim_bw --hive-table account --hive-import -m 1

2 REPLIES 2

Re: Sqoop import from Sybase to Hive failing when the complete table name is given in the import statement

Master Collaborator

Have you tried using the --query option directly and specifying the Sybase query to fetch data?

--query "select * from trim_bw..account where \$CONDITIONS"

Re: Sqoop import from Sybase to Hive failing when the complete table name is given in the import statement

@hrongali

I am following stackoverflow link. Can you try this?

sqoop import --verbose --driver com.sybase.jdbc4.jdbc.SybDriver --connect jdbc:sybase:Tds:dbgbl-tst:8032/DATABASE=trim_bw --query "select * from trim_bw..account where \$CONDITIONS" --fields-terminated-by ',' --username hrongali -P --hive-database trim_bw --hive-table account --hive-import -m 1