title: Sqoop Import from MySQL Server to Hadoop
body: <p>I am trying for importing data from MySQL Server to HDFS via Sqoop. But I am getting certain errors as:</p>
  
  <pre><code>Error: java.io.IOException: SQLException in nextKeyValue
  at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:277)
  at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:556)
  at org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80)
  at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.nextKeyValue(WrappedMapper.java:91)
  at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
  at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
  at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)
  at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
  at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
  at java.security.AccessController.doPrivileged(Native Method)
  at javax.security.auth.Subject.doAs(Subject.java:422)
  at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1698)
  at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
  Caused by: java.sql.SQLException: The statement (1) has no open cursor.
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2901)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:773)
      at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1304)
      at com.mysql.jdbc.MysqlIO.fetchRowsViaCursor(MysqlIO.java:933)
      at com.mysql.jdbc.CursorRowProvider.fetchMoreRows(CursorRowProvider.java:357)
      at com.mysql.jdbc.CursorRowProvider.hasNext(CursorRowProvider.java:291)
      at com.mysql.jdbc.ResultSet.next(ResultSet.java:2834)
      at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:237)
      ... 12 more
  
  16/09/11 17:31:06 INFO mapreduce.Job:  map 100% reduce 0%
  16/09/11 17:31:07 INFO mapreduce.Job: Job job_1473606531803_0004 failed with state FAILED due to: Task failed task_1473606531803_0004_m_000000
  Job failed as tasks failed. failedMaps:1 failedReduces:0
  
  16/09/11 17:31:07 INFO mapreduce.Job: Counters: 12
      Job Counters 
          Failed map tasks=13
          Killed map tasks=3
          Launched map tasks=16
          Other local map tasks=16
          Total time spent by all maps in occupied slots (ms)=112163
          Total time spent by all reduces in occupied slots (ms)=0
          Total time spent by all map tasks (ms)=112163
          Total vcore-milliseconds taken by all map tasks=112163
          Total megabyte-milliseconds taken by all map tasks=114854912
      Map-Reduce Framework
          CPU time spent (ms)=0
          Physical memory (bytes) snapshot=0
          Virtual memory (bytes) snapshot=0
  16/09/11 17:31:07 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
  16/09/11 17:31:07 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 53,373 seconds (0 bytes/sec)
  16/09/11 17:31:07 INFO mapreduce.ImportJobBase: Retrieved 0 records.
  16/09/11 17:31:07 ERROR tool.ImportTool: Error during import: Import job failed!
  </code></pre>
  
  <p>Has any one seen this behavior before? What am I doing wrong here? Pls suggest me solution.</p>
  
  <p>Thanks.</p>