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 - "SQLException in nextKeyValue"

Sqoop - "SQLException in nextKeyValue"

This post is for posterity purposes since we didn't find much on Google and would like to try and give back.

 

In Sqoop we recently were getting the error 'Error: java.io.IOException: SQLException in nextKeyValue' and 'Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid length parameter passed to the LEFT or SUBSTRING function.' when trying to import a specific view from SQL server. To troubleshoot this we listed out all the columns (--columns "Col1,Col2,Col3,Col4") and then removed one by one until the error stopped. That gave us the column that Sqoop was having trouble with. We then took that column and did a simple SELECT col4 from TABLE in our MS SQL query tool and sure enough, the same "Invalid length parameter" message popped up.

 

Turns out the SQL code creating the view on the MS SQL database had a bug in it. And so it really had nothing to do with Sqoop but bubbled up to us since we apparently are the only ones issuing a query against that column.

 

I guess the take away for us was, when running into odd SQL errors, remove Sqoop from the equation and make sure the query Sqoop is issuing runs successfully.

Hope this helps someone, someday.

1 REPLY 1

Re: Sqoop - "SQLException in nextKeyValue"

Community Manager
Thank you for sharing. :)



Cy Jervis, Community Manager

Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

Learn more about the Cloudera Community:
Community Guidelines
How to use the forum
Don't have an account?
Coming from Hortonworks? Activate your account here