teradata查看正在运行的进程_R:JDBC()在连接到Teradata时找不到Java驱动程序路径...

I'm trying to connect to Teradata through RStudio, but for some reason JDBC function has problems recognizing the path where Java drivers sit. See the code below:

library(RODBC)

library(RJDBC)

library(rJava)

# both Java drivers definitely exist

file.exists('/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar')

[1] TRUE

file.exists('/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar')

[1] TRUE

But when I paste those paths in JDBC call...

# allow more elaborated error messages to appear

.jclassLoader()$setDebug(1L)

drv = JDBC("com.teradata.jdbc.TeraDriver","/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar;/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar")

... I get the following error:

RJavaClassLoader: added

'/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar;/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar'

to the URL class path loader WARNING: the path

'/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar;/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar'

does NOT exist, it will NOT be added to the internal class path!

RJavaClassLoader: added

'/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RJDBC/java/RJDBC.jar'

to the URL class path loader RJavaClassLoader: adding Java archive

file

'/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RJDBC/java/RJDBC.jar'

to the internal class path

RJavaClassLoader@3d4eac69.findClass(com.teradata.jdbc.TeraDriver)

- URL loader did not find it: java.lang.ClassNotFoundException: com.teradata.jdbc.TeraDriver

RJavaClassLoader.findClass("com.teradata.jdbc.TeraDriver")

- trying class path "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/java"

Directory, can get

'/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/java/com/teradata/jdbc/TeraDriver.class'?

NO

- trying class path "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RJDBC/java/RJDBC.jar"

JAR file, can get 'com/teradata/jdbc/TeraDriver'? NO

ClassNotFoundException Error in .jfindClass(as.character(driverClass)[1]) : class not found

Running the same code in R, rather than RStudio, returns the same error.

Also, re-installing RJDBC package (as suggested here) didn't solve the issue.

Can anyone explain why this is happening? Thanks for help.

Here's my session info:

> sessionInfo()

R version 3.4.1 (2017-06-30)

Platform: x86_64-apple-darwin15.6.0 (64-bit)

Running under: macOS High Sierra 10.13.3

Matrix products: default

BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib

LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:

[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:

[1] stats graphics grDevices utils datasets methods base

other attached packages:

[1] devtools_1.13.4 RJDBC_0.2-7 rJava_0.9-9 DBI_0.8 RODBC_1.3-15

[6] dplyr_0.7.4 readr_1.1.1

loaded via a namespace (and not attached):

[1] Rcpp_0.12.15 bindr_0.1 magrittr_1.5 hms_0.3 R6_2.2.2

[6] rlang_0.1.6 httr_1.3.1 tools_3.4.1 git2r_0.19.0 withr_2.1.1.9000

[11] yaml_2.1.16 assertthat_0.2.0 digest_0.6.15 tibble_1.4.2 bindrcpp_0.2

[16] curl_3.0 memoise_1.1.0 glue_1.2.0 compiler_3.4.1 pillar_1.1.0

[21] pkgconfig_2.0.1

解决方案

That's a mistake in the path - you have inadvertently pasted two paths together (note the semicolon between the paths). You probably intended

drv

c("/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar",

"/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar"))

note that you probably can make your life easier by simply using

drv

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值