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

Switch to Plain View
Sqoop >> mail # user >> An issue of importing a table from DB2 Luw 97 database using Sqoop 1.4.1


+
sam liu 2012-05-23, 06:53
+
Steve Souza 2012-05-23, 07:16
Copy link to this message
-
Re: An issue of importing a table from DB2 Luw 97 database using Sqoop 1.4.1
But in my command, there is no specific sql and just use sqoop's syntax as
below:
./sqoop import --connect jdbc:db2://9.1111.146.111:50000/SAMPLE --table
DB2ADMIN.DB2TEST_TBL003 --username sam --password db2adminpassword -m 1

By the way, I can successfully executed similar import command on Oracle 11
database server.

2012/5/23 Steve Souza <[EMAIL PROTECTED]>

>
> According to google  the error message means you have invalid characters
> in your sql....
>
> When sql statements contain special characters, for example,
> line breaks, carriage returns, line feeds, receive the following
> error by using the Universal Driver:
> DB2 SQL error: SQLCODE: -7, SQLSTATE: 42601, SQLERRMC:
> This is a simple sample of such a SQL statement:
> static final String sqlQuery = "SELECT empno, firstnme,
> lastname, salary \n"
> + "  FROM employee WHERE workdept='A00'";
>
>
>
> On Wed, May 23, 2012 at 7:53 AM, sam liu <[EMAIL PROTECTED]> wrote:
>
>> Hi,
>>
>> I have an issue of importing a table from DB2 Luw 97 database using
>> Sqoop. Below is the logs. Could any one help me? Thanks in advance very
>> much!
>>
>>
>> [root@localhost bin]# ./sqoop import --connect jdbc:db2://9.1111.146.111:
>> 50000/SAMPLE --table DB2ADMIN.DB2TEST_TBL003 --username sam --password
>> db2adminpassword -m 1
>> Warning: /usr/lib/hbase does not exist! HBase imports will fail.
>> Please set $HBASE_HOME to the root of your HBase installation.
>> 12/05/22 23:35:56 WARN tool.BaseSqoopTool: Setting your password on the
>> command-line is insecure. Consider using -P instead.
>> 12/05/22 23:35:56 INFO manager.SqlManager: Using default fetchSize of 1000
>> 12/05/22 23:35:56 INFO tool.CodeGenTool: Beginning code generation
>> 12/05/22 23:35:59 INFO manager.SqlManager: Executing SQL statement:
>> SELECT t.* FROM DB2ADMIN.DB2TEST_TBL003 AS t WHERE 1=0
>> 12/05/22 23:35:59 INFO manager.SqlManager: Executing SQL statement:
>> SELECT t.* FROM DB2ADMIN.DB2TEST_TBL003 AS t WHERE 1=0
>> 12/05/22 23:35:59 INFO orm.CompilationManager: HADOOP_HOME is
>> /opt/hadoop-0.20.2/bin/..
>> 12/05/22 23:35:59 INFO orm.CompilationManager: Found hadoop core jar at:
>> /opt/hadoop-0.20.2/bin/../hadoop-0.20.2-core.jar
>> Note:
>> /tmp/sqoop-root/compile/56c3a2cc91c28bad8d66ca7b80e997d0/DB2ADMIN_DB2TEST_TBL003.java
>> uses or overrides a deprecated API.
>> Note: Recompile with -Xlint:deprecation for details.
>> 12/05/22 23:35:59 INFO orm.CompilationManager: Writing jar file:
>> /tmp/sqoop-root/compile/56c3a2cc91c28bad8d66ca7b80e997d0/DB2ADMIN.DB2TEST_TBL003.jar
>> 12/05/22 23:35:59 INFO mapreduce.ImportJobBase: Beginning import of
>> DB2ADMIN.DB2TEST_TBL003
>> 12/05/22 23:36:55 INFO manager.SqlManager: Executing SQL statement:
>> SELECT t.* FROM DB2ADMIN.DB2TEST_TBL003 AS t WHERE 1=0
>> 12/05/22 23:37:00 INFO mapred.JobClient: Running job:
>> job_201205222335_0001
>> 12/05/22 23:37:01 INFO mapred.JobClient:  map 0% reduce 0%
>> 12/05/22 23:37:16 INFO mapred.JobClient: Task Id :
>> attempt_201205222335_0001_m_000000_0, Status : FAILED
>> java.io.IOException: SQLException in nextKeyValue
>>         at
>> org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:265)
>>         at
>> org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:423)
>>         at
>> org.apache.hadoop.mapreduce.MapContext.nextKeyValue(MapContext.java:67)
>>         at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:143)
>>         at
>> org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:183)
>>         at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:621)
>>         at org.apache.hadoop.mapred.MapTask.run(MapTask.java:305)
>>         at org.apache.hadoop.mapred.Child.main(Child.java:170)
>> Caused by: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error:
>> SQLCODE=-104, SQLSTATE=42601, SQLERRMC=.;T_TBL003 AS DB2ADMIN;,,
>> DRIVER=3.62.56
>>         at com.ibm.db2.jcc.am.fd.a(fd.java:676)
>>         at com.ibm.db2.jcc.am.fd.a(fd.java:60)