问题
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