Created on 09-12-2013 01:45 PM - edited 09-16-2022 08:05 AM
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)
Created 09-18-2013 09:17 AM
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
Created 09-18-2013 08:14 AM
JDBC Drivers should be downloaded and copied into directory /usr/lib/sqoop/lib as is described in the installation gudie:
Created 09-18-2013 09:17 AM
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
Created 05-07-2015 02:02 AM
how to set the HADOOP_CLASSPATH?
export HADOOP_CLASSPATH=?
Created 11-28-2018 08:08 AM
To what value should you set the HADOOP_CLASSPATH?
Created 05-11-2015 10:19 AM
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/