2

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 ?

Gratien
  • 227
  • 2
  • 9

2 Answers2

2

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

Community
  • 1
  • 1
Gratien
  • 227
  • 2
  • 9
2

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
  • In case you are using FreeTDS or another driver in some configuration, the line should look like `/usr/local/lib/ r, /usr/local/lib/** r, ` or similar. Check what is written after the `name=` parameter in the `kern.log` – zerweck Mar 02 '17 at 09:40