I would like to use a .COM object in R to establish a ADODB.Connection to an OLAP cube. And for that I'm using the rscproxy, rcom and the statconnDCOM packages.
However, I am not really successful in finding any useful documentation for the rcom package, and therefore, I am struggling big times with using .COM objects in R.
I am able to create a .COM object, but I have no idea about the next steps. What I want to do:
# I am quite confident that this section is right:
conn <- comCreateObject("ADODB.Connection")
# From now on it becomes speculative:
connStr = 'Provider=MSOLAP;Data Source=...;Initial Catalog=...;'
# First try to set the connection string:
# Second try to set the connection string:
conn[["ConnectionString"]] = connStr
# I try to establish the connection:
options(install.packages.check.source = "no")
As I have answered my questions after a lot of trial and error approaches, I want to share the solution with you: In the end, I switched from the rcom package to the RDCOMClient package, as I was stuck with the first one.
Download the package:
Download link for the RDCOMClient_ package: (I am using R-3.3.1) https://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.3/
install.packages("local path to: RDCOMClient_0.93-0.2.zip", repos = NULL, type="source") library(RDCOMClient) sessionInfo() conn = COMCreate("ADODB.Connection") conn[["State"]] connStr = 'a connection string' conn[["ConnectionString"]] = connStr conn[["CommandTimeout"]] = 180 conn[["ConnectionTimeout"]] = 30 conn[["State"]] conn$Open() conn[["State"]] query = 'a query' results = conn$Execute(query)