【问题标题】:How to run Sqoop with custom JDBC Driver?如何使用自定义 JDBC 驱动程序运行 Sqoop?
【发布时间】:2013-04-05 16:54:20
【问题描述】:

如果我为 oracle Thin 提供 (--connect/--user/--password),我可以在不提供 --driver 参数的情况下运行 Sqoop。

但我需要使用我的项目中使用的自定义 JDBC 驱动程序(它正确实现 java.sql.Driver 接口)而不是 oracle.jdbc.OracleDriver 来运行它。

我无法通过简单地用--driver 参数证明它来让它工作。 而this suggestion 根本没有帮助。

如何将 Sqoop 与自定义数据库访问驱动程序一起使用? 如何克服我遇到的错误?

如果它与连接管理器有关,谁能告诉我应该指定什么连接管理器?

谢谢!

这是我真正想做的事情:

./sqoop.sh import \
    --fs $HDFS --jt $JT \
    --connect <cutom-connection-string> --username username --password password \
    --table SYS.ALL_TABLES --split-by TABLE_NAME --target-dir /temp/try/110 --verbose \
    --driver xx.xx.xx.MyDriver

我收到一个错误:

ERROR manager.SqlManager:错误执行语句: java.sql.SQLException: ORA-00933: SQL 命令未正确结束

更多错误信息:

DEBUG tool.BaseSqoopTool: Enabled debug logging.
WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
DEBUG sqoop.ConnFactory: Loaded manager factory: com.cloudera.sqoop.manager.DefaultManagerFactory
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.
INFO manager.SqlManager: Using default fetchSize of 1000
INFO tool.CodeGenTool: Beginning code generation
INFO xx.xx.xx.MyDriver: xx.xx.xx.MyDriver registered successfully.
DEBUG manager.SqlManager: No connection paramenters specified. Using regular API for making connection.
INFO xx.xx.xx.MyDriver: Returning database connection
DEBUG manager.SqlManager: Using fetchSize for next query: 1000
INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM SYS.ALL_TABLES AS t WHERE 1=0
ERROR manager.SqlManager: Error executing statement: java.sql.SQLException: ORA-00933: SQL command not properly ended

java.sql.SQLException: ORA-00933: SQL command not properly ended

【问题讨论】:

    标签: jdbc hadoop oracle11g hdfs sqoop


    【解决方案1】:

    您的自定义 JDBC 驱动程序使用正确。问题似乎出在正在使用的通用 jdbc 连接器中,并且似乎产生了无效查询。您可能还需要在Oracle connector 中通过将驱动程序替换为您的自定义驱动程序来分叉构建。

    贾西克

    【讨论】:

    • 是的,谢谢。我终于不得不对 sqoop 连接管理器类做一些奇怪的扩展,并替换那里返回的驱动程序:)
    猜你喜欢
    • 2013-04-08
    • 2014-03-13
    • 2021-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-22
    相关资源
    最近更新 更多