Multi-Shiny App Directory - RJDBC Connection Issue

Viewed 22

Currently have a multi Shiny App directory that builds to Docker

One of the apps (app1) is reliant upon a JDBC connection that gives me SQL Access. The other app (app2) is a dummy app for now that reads a web csv and makes a ggplot.

I can run app1 with JDBC on its own with no issues. I can run to get to the directory of the 2 app setup with links to app1 and app2. When I click on app2, that app runs fine. When I click on app1, I get an error message- The application failed to start. The application exited during initialization.

Here is the Dockerfile code than runs the shiny server, copies the directory of the apps from my local computer to the docker directory(srv/shiny-server). I then open up port 3838 and run shiny-server. The intended goal here is to open up to the directory of the apps showing links to app1 and app2

RUN rm -rf /srv/shiny-server/
COPY app1 /srv/shiny-server/apps/app1
COPY app2 /srv/shiny-server/apps/app2

EXPOSE 3838

CMD ["usr/bin/shiny-server"]

Here is where what my directory of app1 looks like. Pretty standard with UI/Server, R, Folder. Currently I have a jar file in this directory (which works when I run by itself). I have also copied the jar file to a location in a linux directory and declared $CLASSPATH to get it to work.

  • ui.R
  • server.R
  • R (folder; has global.R and other contingencies)
  • mssql-jdbc-10.2.0.jre11.jar (jar file for jdbc driver)

Here is where I declared my connection to the rjdbc. This assumes that the classPath is in same directory as my app, which I believe it is (above). I can also get this to work using Sys.getenv('CLASSPATH') if I declare that.

drv <- JDBC(driverClass = "com.microsoft.sqlserver.jdbc.SQLServerDriver", 
            classPath = 'mssql-jdbc-10.2.0.jre11.jar')

To sum up, I am looking to get the rjdbc connection to work in multi-Shiny app directory. It works when I have one file loaded but not two. I am assuming that there is some permissions to the jar file, environmental variables, or running the app that I am not declaring correctly. The other possibility is I am misreferencing the location of RJDBC in the JDBC function or the CLASSPATH itself.

Ideally, I would like to have one rjdbc driver that multiple apps can reference.

Any guidance would be helpful

0 Answers
Related