Closed ruaridhw closed 6 years ago
The documentation for Linux and Windows also needs a refresh as there are several known issues with rClr on Mono and newer versions of .NET for Windows.
See jmp75/rClr#27 and jmp75/rClr#31 for rClr build errors on Linux and macOS
Excellent idea! I will try to help on this.
Excellent. That was very fast. Excellent.
@agstudy would you like to test the docker help script so that it's easy enough to follow along?
Also, if you prefer using RStudio Server for easier interactivity over command line R, you can download these two files over the top of the current Dockerfile and then in docker.sh
run:
docker build -t rsqlserver-rstudio .
instead of docker pull ruaridhw/rsqlserver:latest
and replace rsqlserver-rstudio
everywhere there is ruaridhw/rsqlserver
The RStudio server will then run as a service in the background and can be accessed at http://localhost:8787
Probably best to test both cases.
I have tested the docker.sh.
I think it works , but I am not sure becuase I don't know how to test it now.
PS: I have added me as a docker user: sudo usermod -aG docker $USER
Sorry, I just mean trial the script so it's easy to understand and works as expected. You can run both images together or independently:
Independently: Trial both images separately by:
docker.sh
) and issue any test R commands you likehost = localhost
from any desktop client (eg. SSMS, Visual Studio, Navicat ...)Together: Run the R session interactively and library(rsqlserver)
in your session. Then you can connect to the DB image with con <- dbConnect('SqlServer', host = 'mydb', dbname = 'rsqlserverdb', user = 'SA', password = 'P@ssw0rd1')
as per the second last part.
I tested the 2 last statements:
docker run --name testrsqlserver --link=mssqldb --rm ruaridhw/rsqlserver Rscript \
-e "library(rsqlserver)" \
-e "con <- dbConnect('SqlServer', host = 'mydb', dbname = 'rsqlserverdb', user = 'SA', password = 'P@ssw0rd1')" \
-e "dbReadTable(con, 'Inventory')"
Works fine and give the expecte dresult :
id name quantity
1 1 banana 150
2 2 orange 154
Then I tested the intercative R session and it works fine also:
docker rm rsqlserver122
docker run --name rsqlserver122 --link=mssqldb -i ruaridhw/rsqlserver
Excellent job!
Now, How I can call the rsqlserver from Rstudio session?
Do you mean your local RStudio installation? It's exactly as on the R image except for host
:
con <- dbConnect('SqlServer', host = 'localhost', dbname = 'rsqlserverdb', user = 'SA', password = 'P@ssw0rd1')
Since I'm on a Mac, I can't run rsqlserver on my local RStudio so I have to run RStudio Server on a Docker image. That's what I was referring to here
Build a Docker image that can be used to run the package on macOS, Linux and Windows in a self-contained environment.
Relates to #24 #16 #13
docker.sh
for easy installation and use of imagesdocker.sh
docker.sh
using compose to avoid manually starting multiple containers