3

There are a couple of related threads here, but the gist of my attempt to connect to Vertica with R over OpenCPU and vRODBC is:

  1. I started with RJDBC, which works fine in RStudio (even the server RStudio edition), but OpenCPU/rApache doesn't like it. rJava on OpenCPU
  2. I installed the vRODBC package which is a derivative of RODBC and I successfully queried Vertica from both the CMD Line using isql and from RStudio Server using the DSN and odbcConnect('myDSNName') Installing vRODBC
  3. When I compile the app with code that works on RStudio Server I get a connection error when trying to run it over OpenCPU (pulled from the console):

It works from the RStudio Server

> vertica =  odbcConnect("VerticaDSN")
> data = sqlQuery(vertica, query)
> data
  TDIDCount
1      3015

But not from the Opencpu App I created

//From Console Output
[vRODBC] ERROR: state 01000, code 0, message [unixODBC][Driver Manager]Can't open lib '/opt/vertica/lib64/libverticaodbc.so.6.1.3' : file not found
Warning message:
ODBC connection failed
[1] -1

I checked this path and it clearly does exist. I found another question which says that this error is caused by a dependency that can't be loaded for the libverticaodbc.so library so I tried to follow steps to see which library I might not have had permissions for with the opencpu user to no avail. Can't open lib with UnixODBC

$ sudo su - opencpu
$ ldd /opt/vertica/lib64/libverticaodbc.so.6.1.3
        linux-vdso.so.1 =>  (0x00007fff5cd10000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f16a30cc000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f16a2eb1000)
        libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f16a2c77000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f16a2a59000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f16a2755000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f16a244e000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f16a2238000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f16a1e73000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f16a4854000)
$

I'm close... very close... I can feel it... just gotta get some shadowy environment variable or permissions fixed so that OpenCPU can correctly find the ODBC drivers and then I'll have more R+webApp glory propelling me forward!

Community
  • 1
  • 1

0 Answers0