通过R连接到雅典娜 [英] Connecting to Athena via R
问题描述
我指的是这篇文章将R连接到雅典娜。
I am referring to this article for connecting R to Athena.
在定义驱动程序时,出现以下错误:
When defining the driver, I am getting the following error :
.jfindClass(as.character(driverClass)[1])中的错误:找不到类
Error in .jfindClass(as.character(driverClass)[1]) : class not found
我做了一些研究,然后来到此页面。接受的答案带有说明相同问题的评论。但是,提供的解决方案(即重新启动R)无效。
I did some research and I arrived at this page. The accepted answer has a comment stating the same problem. However, the solution provided (i.e. restarting R) didn't work.
到目前为止,我已经编写了以下代码。
I have written the following code till now.
library("pacman")
pacman::p_load("RJDBC")
pacman::p_load("dplyr")
# Downloading Athena driver to the working directory
URL <- 'https://s3.amazonaws.com/athena-downloads/drivers/AthenaJDBC41-1.0.0.jar'
fil <- basename(URL)
if (!file.exists(fil)) download.file(URL, fil)
# Defining driver
drv <- JDBC(driverClass="com.amazonaws.athena.jdbc.AthenaDriver", fil, identifier.quote="'")
我正在使用RStudio,并且正在Windows上运行它。
关于如何解决此问题的任何建议将受到高度赞赏。
I am using RStudio and I am running it on Windows. Any suggestions on how to resolve this problem will be highly appreciated.
推荐答案
下载.file
命令默认以字符模式写入,而不是二进制。您应该指定二进制模式:
The download.file
command writes in character mode by default, not binary. You should specify binary mode:
download.file(URL, fil, mode="wb")
这篇关于通过R连接到雅典娜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!