从Amazon reference逐字执行代码时,找不到驱动程序功能。我已经安装并加载了RJDBC软件包,但是找不到JDBC函数。请原谅下面的输出。我将其包括在内,以显示引用中的逐字代码对我返回错误。
平台x86_64-apple-darwin15.6.0
拱形x86_64
os darwin15.6.0
系统x86_64,darwin15.6.0
状态
专业3
次要5.1
version.string R版本3.5.1(2018-07-02)
昵称Feather Spray
> library(RJDBC)
Loading required package: rJava
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
Reason: image not found
Error: package ‘rJava’ could not be loaded
In addition: Warning message:
In system("/usr/libexec/java_home", intern = TRUE) :
running command '/usr/libexec/java_home' had status 1
>
> # download Amazon Redshift JDBC driver
> download.file('http://s3.amazonaws.com/redshift-downloads/drivers/RedshiftJDBC41-1.1.9.1009.jar','RedshiftJDBC41-1.1.9.1009.jar')
trying URL 'http://s3.amazonaws.com/redshift-downloads/drivers/RedshiftJDBC41-1.1.9.1009.jar'
Content type 'application/x-java-archive' length 2055261 bytes (2.0 MB)
==================================================
downloaded 2.0 MB
>
> # connect to Amazon Redshift
> driver <- JDBC("com.amazon.redshift.jdbc41.Driver", "RedshiftJDBC41-1.1.9.1009.jar", identifier.quote="`")
Error in JDBC("com.amazon.redshift.jdbc41.Driver", "RedshiftJDBC41-1.1.9.1009.jar", :
could not find function "JDBC"