sqoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vasanth kumar <rj.vasanthku...@gmail.com>
Subject Re: sqoop2 export from hdfs into mysql - hitting sqlexception - parameter index out of range
Date Tue, 08 Apr 2014 08:25:13 GMT
Hi Suhas,

Check the export job input's table name or in Sqoop 2 job's input, give
value to "Table Name:" just leave blank for columns.
Share you export job inputs.


On Tue, Apr 8, 2014 at 5:09 AM, Suhas Satish <suhas.satish@gmail.com> wrote:

> Hi
> I'm trying to export a csv from hdfs into mysql using sqoop2 in hue as
> demonstrated here (view snapshot).
> http://gethue.com/hadoop-tutorials-series-ii-8-how-to-transfer-data/
>
> input data sample-  cat /user/root/s2t4/part-m-00000
> 1,'nick miller',68,'green',717.12,13809
> 2,'ulysses white',48,'green',840.06,19451
> 3,'holly garcia',18,'democrat',128.2,8750
> 4,'victor thompson',61,'independent',721.6,20462
>
> This is my* table schema* -
> create table voterimport (
> rownum int(11) default NULL,
> name varchar(50) default NULL,
> age tinyint(4) default NULL,
> registration varchar(15) default NULL,
> contributions float default NULL,
> voterzone smallint(6) default NULL);
>
>
> But I'm hitting this sqlexception. Which parameters is it talking about?
>
>
>
> Caused by: org.apache.sqoop.common.SqoopException: GENERIC_JDBC_CONNECTOR_0002:Unable
to execute the SQL statement	at org.apache.sqoop.connector.jdbc.GenericJdbcExecutor.addBatch(GenericJdbcExecutor.java:177)
> 	at org.apache.sqoop.connector.jdbc.GenericJdbcExportLoader.load(GenericJdbcExportLoader.java:50)
> 	at org.apache.sqoop.connector.jdbc.GenericJdbcExportLoader.load(GenericJdbcExportLoader.java:25)
> 	at org.apache.sqoop.job.mr.SqoopOutputFormatLoadExecutor$ConsumerThread.run(SqoopOutputFormatLoadExecutor.java:228)
> 	... 6 moreCaused by: java.sql.SQLException: Parameter index out of range (2 > number
of parameters, which is 1).
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
> 	at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:2796)
> 	at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:3627)
> 	at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:3029)
> 	at org.apache.sqoop.connector.jdbc.GenericJdbcExecutor.addBatch(GenericJdbcExecutor.java:173)
>
>
>
>
> This is from GenericJdbcExecutor.java - sqoop2 code
>   public void addBatch(Object[] array) {
>     try {
>       for (int i=0; i<array.length; i++) {
>         preparedStatement.setObject(i+1, array[i]);
>       }
> *      preparedStatement.addBatch();*
>     } catch (SQLException e) {
>       throw new SqoopException(
>           GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0002, e);
>     }
>   }
>
> How do I get around this issue?
>
>
> Thanks,
> Suhas.
>



-- 
Regards
Vasanth kumar RJ

Mime
View raw message