Support Questions
Find answers, ask questions, and share your expertise

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: SQLException in nextKeyValue' and 'Caused by: 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.


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