使用 ojdbc6 连接器导入 Sqoop
Sqoop import using ojdbc6 connector
我正在使用 sqoop 从 oracle 11g 导入数据,因为我没有权限将 ojdbc jar 放入集群上的 sqoop 库中,我使用 -libjars 明确提供了 jar,但它正在抛出 exception.The 我用过的代码是:
sqoop eval -libjars /root/shared_folder/ojdbc6.jar --driver oracle.jdbc.OracleDriver --connect jdbc:oracle:thin:@127.0.0.1:1521:XE --username srivastavaaman --password manager --query 'SELECT * from TestTable1'
后面的输出是:
Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
17/04/05 02:48:40 INFO sqoop.Sqoop: Running Sqoop version: 1.4.4.2.1.1.0-385
17/04/05 02:48:41 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
17/04/05 02:48:41 WARN sqoop.ConnFactory: Parameter --driver is set to an explicit driver however appropriate connection manager is not being set (via --connection-manager). Sqoop is going to fall back to org.apache.sqoop.manager.GenericJdbcManager. Please specify explicitly which connection manager should be used next time.
17/04/05 02:48:41 INFO manager.SqlManager: Using default fetchSize of 1000
17/04/05 02:48:41 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.SqlManager.makeConnection(SqlManager.java:797)
at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
at org.apache.sqoop.tool.EvalSqlTool.run(EvalSqlTool.java:64)
at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:222)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:231)
at org.apache.sqoop.Sqoop.main(Sqoop.java:240)
如果相同的 ojdbc6.jar 被放置在本地机器的 sqoop 库中,它工作正常。
-libjars
参数通常不与 Sqoop 一起使用,但作为 Hadoop 内部参数解析系统的一部分添加。
将 Jar 文件的路径附加到 $HADOOP_CLASSPATH
变量。
export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:/root/shared_folder/ojdbc6.jar
sqoop eval --driver oracle.jdbc.OracleDriver --connect jdbc:oracle:thin:@127.0.0.1:1521:XE --username ****** --password ***** --query 'SELECT * from TestTable1'
我正在使用 sqoop 从 oracle 11g 导入数据,因为我没有权限将 ojdbc jar 放入集群上的 sqoop 库中,我使用 -libjars 明确提供了 jar,但它正在抛出 exception.The 我用过的代码是:
sqoop eval -libjars /root/shared_folder/ojdbc6.jar --driver oracle.jdbc.OracleDriver --connect jdbc:oracle:thin:@127.0.0.1:1521:XE --username srivastavaaman --password manager --query 'SELECT * from TestTable1'
后面的输出是:
Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
17/04/05 02:48:40 INFO sqoop.Sqoop: Running Sqoop version: 1.4.4.2.1.1.0-385
17/04/05 02:48:41 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
17/04/05 02:48:41 WARN sqoop.ConnFactory: Parameter --driver is set to an explicit driver however appropriate connection manager is not being set (via --connection-manager). Sqoop is going to fall back to org.apache.sqoop.manager.GenericJdbcManager. Please specify explicitly which connection manager should be used next time.
17/04/05 02:48:41 INFO manager.SqlManager: Using default fetchSize of 1000
17/04/05 02:48:41 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.SqlManager.makeConnection(SqlManager.java:797)
at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
at org.apache.sqoop.tool.EvalSqlTool.run(EvalSqlTool.java:64)
at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:222)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:231)
at org.apache.sqoop.Sqoop.main(Sqoop.java:240)
如果相同的 ojdbc6.jar 被放置在本地机器的 sqoop 库中,它工作正常。
-libjars
参数通常不与 Sqoop 一起使用,但作为 Hadoop 内部参数解析系统的一部分添加。
将 Jar 文件的路径附加到 $HADOOP_CLASSPATH
变量。
export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:/root/shared_folder/ojdbc6.jar
sqoop eval --driver oracle.jdbc.OracleDriver --connect jdbc:oracle:thin:@127.0.0.1:1521:XE --username ****** --password ***** --query 'SELECT * from TestTable1'