Support Questions

Find answers, ask questions, and share your expertise

Sqoop error with Oracle: Could not load db driver class: oracle.jdbc.OracleDriver

avatar
Contributor

Hi All,

I am having an issue with sqoop against an Oracle database. HDP2.4. Oracle 11 XE in AWS RDS.

[root@ip-172-31-29-111 lib]# sqoop list-tables --connect jdbc:oracle:thin:@//dbip:dbport/dbname --username myusername -password mypassword
Warning: /usr/hdp/2.4.2.0-258/accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
16/09/02 15:23:54 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.4.2.0-258
16/09/02 15:23:54 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
16/09/02 15:23:54 INFO oracle.OraOopManagerFactory: Data Connector for Oracle and Hadoop is disabled.
16/09/02 15:23:54 INFO manager.SqlManager: Using default fetchSize of 1000
16/09/02 15:23:54 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:287)
    at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
    at org.apache.sqoop.manager.OracleManager.listTables(OracleManager.java:745)
    at org.apache.sqoop.tool.ListTablesTool.run(ListTablesTool.java:49)
    at org.apache.sqoop.Sqoop.run(Sqoop.java:148)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
    at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:184)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:226)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:235)
    at org.apache.sqoop.Sqoop.main(Sqoop.java:244)

The equivalent against a PostgreSQL works fine.

The below is the list of jar files under sqoop library directory.

[root@ip-172-31-29-111 lib]# ls /usr/hdp/current/sqoop-client/lib/
ant-contrib-1.0b3.jar  commons-jexl-2.1.1.jar  jackson-mapper-asl-1.9.13.jar  opencsv-2.3.jar  parquet-generator-1.4.1.jar
ant-eclipse-1.0-jvm1.2.jar  commons-logging-1.1.1.jar  kite-data-core-1.0.0.jar  paranamer-2.3.jar  parquet-hadoop-1.4.1.jar
avro-1.7.5.jar  hsqldb-1.8.0.10.jar  kite-data-hive-1.0.0.jar  parquet-avro-1.4.1.jar  parquet-jackson-1.4.1.jar
avro-mapred-1.7.5-hadoop2.jar
  jackson-annotations-2.3.0.jar  kite-data-mapreduce-1.0.0.jar  
parquet-column-1.4.1.jar  postgresql-9.2-1002.jdbc4.jar
commons-codec-1.4.jar
  jackson-core-2.3.1.jar  kite-hadoop-compatibility-1.0.0.jar  
parquet-common-1.4.1.jar  slf4j-api-1.6.1.jar
commons-compress-1.4.1.jar
  jackson-core-asl-1.9.13.jar  mysql-connector-java.jar  
parquet-encoding-1.4.1.jar  snappy-java-1.0.5.jar
commons-io-1.4.jar  jackson-databind-2.3.1.jar  ojdbc6.jar 

Earlier I have downloaded and copied the oracle jdbc connector jar file from the below Oracle page.

http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html

Please advise the solution to avoid the error.

Thanks,

1 ACCEPTED SOLUTION

avatar
Expert Contributor

-rw-r--r--1 root root 2123 Sep214:31 ojdbc6.jar

ojdbc.jar is much more than 2123 bytes. Most likely your download of the ojdbc.jar was not good

View solution in original post

12 REPLIES 12

avatar
Contributor

Thanks Constantin,

This issue was resolved as updated.

FYI, the SQOOP_HOME variable has always been empty in any user. I think somehow sqoop, as a part of a default HDP installation, is configured to locate lib files under /usr/hdp/current/sqoop-client/lib/ regardless of the variable value.

avatar
Expert Contributor

-rw-r--r--1 root root 2123 Sep214:31 ojdbc6.jar

ojdbc.jar is much more than 2123 bytes. Most likely your download of the ojdbc.jar was not good

avatar
Contributor

Thank you vranganathan. This issue is resolved.

As you pointed out there was a problem with the ojdbc6.jar file itself.

downloading directly via the web url of the file neither download the complete file, nor spit error. I guess this is because of the web authentication oracle requires.

After manually downloading the file after authentication and transferring the file into the sqoop host did the trick.

Thanks again.