SQOOP 1 未能加载 Sybase 驱动程序 - 无法加载 db 驱动程序类:com.sybase.jdbc3.jdbc.SybDriver
Posted
技术标签:
【中文标题】SQOOP 1 未能加载 Sybase 驱动程序 - 无法加载 db 驱动程序类:com.sybase.jdbc3.jdbc.SybDriver【英文标题】:SQOOP 1 failed to load Sybase driver - Could not load db driver class: com.sybase.jdbc3.jdbc.SybDriver 【发布时间】:2017-03-03 07:18:07 【问题描述】:我正在尝试使用 sqoop-1 从 sybaseIQ 导入数据。 jdts-1.3.1.jar
放在 /sqoop/sqoop-1.4.6/lib
文件夹中。
当这个语法运行时,
sqoop import --connect '`jdbc:jtds:sybase:tds`://10.***.*.***@5500:*****' --driver 'com.sybase.jdbc3.jdbc.SybDriver' --username "username" --password -p --query "select * from dw.DM_ADDRESS where rownum <= 1000 and \$CONDITIONS" --target-dir "/user/*****/WT_Address_Itc" --split-by 1 --verbose
and am getting this error:
17/03/02 11:15:19 DEBUG manager.SqlManager: Execute getColumnInfoRawQuery : select * from dw.DM_ADDRESS_ITC where rownum <= 1000 and (1 = 0)
17/03/02 11:15:19 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: com.sybase.jdbc3.jdbc.SybDriver
java.lang.RuntimeException: Could not load db driver class: com.sybase.jdbc3.jdbc.SybDriver
at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:856)
at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:744)
at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:767)
at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:270)
at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:241)
at org.apache.sqoop.manager.SqlManager.getColumnTypesForQuery(SqlManager.java:234)
at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:304)
at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1833)
at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1645)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:107)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:606)
at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
我在这里缺少什么?我是否使用了正确的驱动程序?这是http://jtds.sourceforge.net/ 网站上提供的那个?
非常感谢您在这方面的帮助!
【问题讨论】:
【参考方案1】:驱动类com.sybase.jdbc3.jdbc.SybDriver
属于jconn3.jar
下载jconn3.jar
,放到$SQOOP_HOME/lib
目录下。
而且connectionString必须是,
jdbc:sybase:Tds:dbhost:dbport/DATABASE=dbname
【讨论】:
我已将 jconn3.jar 放在 $SQOOP_HOME/lib 中,并且我也更改了连接字符串...但是运行脚本给了我这个异常,ERROR manager.SqlManager: Error execution statement: java.sql.SQLException: JZ003: URL 格式不正确。 URL:java.sql.SQLException:JZ003:URL 格式不正确。 URL:com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source) at com.sybase.jdbc3.tds.Tds.login(Unknown Source) @karthee 你能评论一下使用的确切连接字符串吗? --connect 'jdbc:sybase:Tds://10.100.*.***:5500/DATABASE=iqprod1' --driver 'com.sybase.jdbc3.jdbc.SybDriver'跨度> 不需要引导主机的//
。试试jdbc:sybase:Tds:10.100.*.***:5500/DATABASE=iqprod1
谢谢@franklinsijo。它运行得很好。以上是关于SQOOP 1 未能加载 Sybase 驱动程序 - 无法加载 db 驱动程序类:com.sybase.jdbc3.jdbc.SybDriver的主要内容,如果未能解决你的问题,请参考以下文章