Support Questions

Find answers, ask questions, and share your expertise

Use sqoop to import Oracle table to HFDS. Oracle JDBC jar is not installed to $SQOOP_HOME/lib

avatar
New Contributor

I want to run sqoop to import Oracle to HDFS. Our default CDH deployment does not have Oracle JDBC driver. So I downloaded the driver and saved  to my home directory on CDH proxy server. I tried to run sqoop using --libjars to use the driver, but it was not working. Can you advise how to get this working?

 

sqoop import  --libjars <my dir>/ojdbc6.jar --connect jdbc:oracle:thin:@//<host>:8526/<SID> --table pstobj2 --username <username> --password <pass> --target-dir <dir path>/table_name
13/09/12 16:42:38 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
13/09/12 16:42:38 INFO manager.SqlManager: Using default fetchSize of 1000
13/09/12 16:42:38 INFO tool.CodeGenTool: Beginning code generation
13/09/12 16:42:38 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: oracle.jdbc.OracleDriver
java.lang.RuntimeException: Could not load db driver class: oracle.jdbc.OracleDriver
        at org.apache.sqoop.manager.OracleManager.makeConnection(OracleManager.java:275)
        at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
        at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:525)
        at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:548)
        at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:191)
        at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:175)
        at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:262)
        at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1236)
        at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1061)
        at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:82)
        at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:390)
        at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:476)
        at org.apache.sqoop.Sqoop.run(Sqoop.java:145)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
        at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:181)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:220)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:229)
        at org.apache.sqoop.Sqoop.main(Sqoop.java:238)

 

1 ACCEPTED SOLUTION

avatar
Cloudera Employee

If you have installed sqoop using parcels, you will need to set the HADOOP_CLASSPATH in your environment to specify the JDBC driver. 

You can set this in the client's configuration file: /etc/sqoop/conf/sqoop-env.sh 

 

 

View solution in original post

5 REPLIES 5

avatar
Contributor

JDBC Drivers should be downloaded and copied into directory /usr/lib/sqoop/lib as is described in the installation gudie:

 

http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH4-Installation-Guide/c...

avatar
Cloudera Employee

If you have installed sqoop using parcels, you will need to set the HADOOP_CLASSPATH in your environment to specify the JDBC driver. 

You can set this in the client's configuration file: /etc/sqoop/conf/sqoop-env.sh 

 

 

avatar
Contributor

how to set the HADOOP_CLASSPATH?

 

export HADOOP_CLASSPATH=?

avatar
New Contributor

To what value should you set the HADOOP_CLASSPATH? 

avatar
Contributor

were you able to solve the issue? If same issue persists, please check the permission

 

it should be sqoop:sqoop 755 and placed in sqoop lib.

 

In case of parcels, /var/lib/sqoop/

 

In case of packages, /usr/lib/sqoop/lib/