I have a peculiar problem while trying to accessing database on remote server via opencpu javascript library for R and RMySQL library. Particularity, I have written R function that uses RMySQL library to access data from remote mysql server. And I am calling this R function from web application using opencpu java script library.
Function is able to connect (to remote mysql) and execute inside R shell on the server. But not through the opencpu library. Mysql connection settings are in ~/.my.cnf as instructed by RMySql package.
So, to tell briefly about the development environment set up
- I have installed opencpu-server, r and my package containing function on ubuntu server 14.04 running on vmware.
- MySql is out side vmware on host Ubuntu operating system.
Error that I am getting on the Opencpu client side
Failed to connect to database: Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
In call:
.local(drv, ...)
I am suspecting if opencpu server is not checking ~/.my.cnf for db connection settings. Any pointers to fix the problem would be helpful.
Thank you