2
votes

I need to fetch data on a SQL Server through opencpu. RODBC works perfectly with single-user version of opencpu. However on the cloud server I get this error:

first argument is not an open RODBC channel
In call:
RODBC::sqlQuery(dbhandle, sql_query)

The very same function fetches data perfectly on Rstudio server (same server ubuntu 16.04, same connection string, using driver FreeTDS).

Is there some special driver settings I'm missing for ODBC to work with opencpu ?

2

2 Answers

2
votes

Finally found this question that helped a lot.

Looks like the problem was AppArmor. By opening /var/log/kern.log I realized there were some rules to add in /etc/apparmor.d/opencpu.d/custom

2
votes

As an example, if you use msodbcsql, the following line in /etc/apparmor.d/opencpu.d/custom should work:

/opt/microsoft/msodbcsql/** r,

Don't forget to restart apparmor:

sudo service apparmor restart