Unable to make JDBC connection when running as rstudio-connect user

September 19, 2019 @jeff.keller Jeff Keller

@jeff.keller wrote:

This is a weird one...

I have a shiny app that calls out to a database using a JDBC connection with a .jar file that is supplied with the app bundle. The code runs fine on other machines and looks like:

driver <- RJDBC::JDBC(driverClass = "net.snowflake.client.jdbc.SnowflakeDriver", 
        classPath = "localfile.jar")
conn <- RJDBC::dbConnect(driver, url, username, password)
RJDBC::dbGetQuery(conn, statement = sql)

However on Connect, this code throws an error when run as the default rstudio-connect user:

Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1],  : 
  java.lang.NoClassDefFoundError: Could not initialize class 
  net.snowflake.client.core.SFTrustManager

On a hunch, I added a super user on the RStudio Connect host machine to the rstudio-connect group and ran the app under that user and it works!

I'm at a loss here... what possible permissions could the default rstudio-connect user be lacking such that this file (or something Java related) is not accessible? I feel like there are so many possibilities I'm hoping someone knowledgeable could help narrow it down.

Posts: 4

Participants: 2

Read full topic

Previous Article
RStudio Connect 1.7.8 - Put a pin in it!
RStudio Connect 1.7.8 - Put a pin in it!

This release adds new workflows for data scientists and improved production settings for administrators. Fo...

Next Article
Unable to connect to a presto database via R in windows
Unable to connect to a presto database via R in windows

@Kapardhi wrote: Hi I am trying to connect to a presto database via R using src_...