I have a shiny app running on Ubuntu 14.10 that I need to connect to a SQL Server database. I am using JDBC for the connection.
Outside of the app (in the console) I have been able to install the JDBC package and its dependencies, load it, and connect and query the database with no issues.
However, when I try to do this in my shiny app running on a shiny server, the app fails to load, and I get these errors from my browser:
Listening on http://127.0.0.1:51925
Loading required package: DBI
Loading required package: rJava
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/local/lib/R/site-library/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
The error occurs because rJava isn't loading. However, when I run from the console as user "shiny," both rJava and RJDBC load without issue.
Any suggestions?
I'm still not entirely sure what the issue is between Shiny and rJava, but I have been able to get my app working regardless.
While the Microsoft SQL Server ODBC driver documentation does not explicitly mention support for Ubuntu, it will work using the same setup as for Suse. Then, since the RODBC package does not have any dependencies on rJava, the connection to the remote database works fine.
In short: if you plan on deploying a Shiny app on Ubuntu and need to make a SQL Server connection, use ODBC instead of JDBC. It will make your life a lot easier.