nfultz / AWR.Athena

Short R Wrapper for Athena JDBC connections
23 stars 13 forks source link

Driver doesn't accept environment variables #12

Closed bmewing closed 5 years ago

bmewing commented 6 years ago

Trying out the package on Windows 10x64 and I can't initialize a connection using system environment variables. I'm just goofing around right now so I don't have a file with these pre-stored. I installed from github directly. I've replaced my personal info with dummy levels.

Sys.setenv("AWS_ACCESS_KEY_ID"="id",
                 "AWS_SECRET_ACCESS_KEY"="key")
library(DBI)
con <- dbConnect(AWR.Athena::Athena(), region='us-east1', s3_staging_dir='s3://bucket', schema_name='schema')

Yields this error:

Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1],  : 
  java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.athena.jdbc.shaded.com.amazonaws.ClientConfiguration
nfultz commented 6 years ago

It works for me on linux :(

The Athena driver runs in the java subprocess, so maybe on windows it can't "see" env vars from the R process? What happens if you sent the env vars outside of R, then start it?

Also try using rjava to make sure that the environment variables are accessible from there - eg

a <- J("java.lang.System")$getenv(name="AWS_ACCESS_KEY_ID")
nfultz commented 5 years ago

Please reopen if this is still present in the new version.