Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Sqoop, mail # user - Sqoop export failed: Incorrect syntax near ','


Copy link to this message
-
Sqoop export failed: Incorrect syntax near ','
Chun-fan Ivan Liao 2012-12-04, 09:51
Hi,

We are using Sqoop 1.3.0-cdh3u4 with Hadoop version 1.0.3.

We encountered the following error when we try to export HDFS file into
MSSQL 2005 (partially):

12/12/04 16:44:13 INFO mapred.JobClient: Task Id :
attempt_201212041541_0014_m_000000_2, Status : FAILED

java.io.IOException: com.microsoft.sqlserver.jdbc.SQLServerException:
Incorrect syntax near ','.

        at
com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:195)

        at
org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:651)

        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:766)

        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370)

        at org.apache.hadoop.mapred.Child$4.run(Child.java:255)

        at java.security.AccessController.doPrivileged(Native Method)

        at javax.security.auth.Subject.doAs(Subject.java:416)

        at
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)

        at org.apache.hadoop.mapred.Child.main(Child.java:249)

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect
syntax near ','.

        at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)

        at
com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)

        at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:390)

        at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340)

        at
com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)

        at
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)

        at
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)

        at
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)

        at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(SQLServerPreparedStatement.java:322)

        at
com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:234)

The HDFS file that we want to export was imported using sqoop from SQL 2005
before and uses ‘|’ as field delimiter, and there are commas (‘,’) in a
field of a line in the file.

The commands I submitted is (generalized with capital letters):

$ sqoop export -D sqoop.export.records.per.statement=75 -D
sqoop.export.statements.per.transaction=75 --connect
"jdbc:sqlserver://SERVER-NAME:1433;username=USER_NAME;password=PASSWD;database=DB_NAME"
--table TABLE_NAME -m 1 --input-fields-terminated-by '|' --export-dir
/EXPORT/FROM/DIRECTORY

I’ve adjusted values of sqoop.export.records.per.statement &
sqoop.export.statements.per.transaction, but that didn’t help.

It will be greatly appreciated if you can offer some help. Thanks.

Ivan