Connecting to Athena via R

二次信任 提交于 2020-04-16 05:10:39

问题


I am referring to this article for connecting R to Athena.

When defining the driver, I am getting the following error :

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

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="'")

I am using RStudio and I am running it on Windows. Any suggestions on how to resolve this problem will be highly appreciated.


回答1:


The download.file command writes in character mode by default, not binary. You should specify binary mode:

download.file(URL, fil, mode="wb")


来源:https://stackoverflow.com/questions/42683348/connecting-to-athena-via-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!