ramazon-athenarjdbc

Athena Connection with R


I am new to Athena. I want to connect this with R

Sys.getenv()
    URL <- 'https://s3.amazonaws.com/athena-downloads/drivers/AthenaJDBC42_2.0.14.jar'
fil <- basename(URL)
if (!file.exists(fil)) download.file(URL, fil)

drv <- JDBC(driverClass="com.simba.athena.jdbc.Driver", fil, identifier.quote="'")

This is the error message

Error in .jfindClass(as.character(driverClass)[1]) : 
  java.lang.ClassNotFoundException

Referred this article https://aws.amazon.com/blogs/big-data/running-r-on-amazon-athena/

   con <- jdbcConnection <- dbConnect(drv, 'jdbc:awsathena://athena.ap-south-1.amazonaws.com:443/',
                                   s3_staging_dir="s3://aws-athena-query-results-ap-south-1-region/",
                                   user=("xxx"),
                                   password=("xxx"))  

Need help really struggling from two days

Thanks in advance. I downloaded jar files and java.


Solution

  • You are using a newer driver version and the driver is now developed by simba and therefore the driver class name has changed.

    The driver class is now com.simba.athena.jdbc.Driver.

    You may also want to check out AWR.Athena - A nice R package to interact with Athena.