Connect to snowflake db with shinyapps.io

Can shinyapps.io connect to Snowflake db? I see that in the shinyapps doc that snowflake isn't explicitly mentioned but the doc says that Rstudio pro drivers are available. In clicking through to rstudio pro drivers, snowflake (preview) is available. I tried dbConnect(odbc::odbc(), Driver = "Snowflake", Database=mydb, UID=********, PWD=*****) but when I run the app I get that "Can't open lib 'Snowflake' : file not found"

Is there a way to connect or am I wasting my time?

Try connecting with these parameters:

conn <- DBI::dbConnect(odbc::odbc(), 
    Driver = "Snowflake",
    UID = "xxx",
    PWD = "xxx",
    Port = 443,
    Warehouse = "xxx",
    Database = "xxx",
    Schema = "xxx",
    Server = "<youraccountid>.snowflakecomputing.com"
)

That worked for my app.

Snowflake's guide to ODBC configuration: ODBC Configuration and Connection Parameters — Snowflake Documentation

1 Like

Hello,

I'm having intermittent crashes on my Shiny app while using the Snowflake RJDBC driver. The app crashes and I see this error in the logs:

Warning: Error in .jcall: net.snowflake.client.jdbc.SnowflakeSQLException: Connection has been closed.

I tried to use the above with my db parameters but am getting this error now. I haven't registered the data source in Windows because I need it to work on shinyapps. Thank you for any help!

It looks like you are trying to use the ODBC connector with a JDBC driver. Can't help with the first error though :frowning:

1 Like

UPDATE: OK nevermind, I needed to deploy to Shinyapps (obviously wouldn't work in Windows without setting up the DSN). Seems to work so far! I'm hoping switching to this driver fixes the random disconnects.

Thanks all.