0

I am trying to run some queries in Oracle SQL through R using RODBC but it doesn't work, not matter what I try.

I installed the "basic", "sqlplus", "odbc" and "sdk" packages from Oracle (yes, I know sdk and sqlplus aren't strictly needed), did all the path settings needed, copied libodbcinst.2.dylib to the instant client folder, installed the odbc driver in odbcinst.ini, tried changing dynlib locations through install_name_tool, even tried adding "arch -x86_64" before the driver name on odbcinst.ini - all to no avail.

I am using a MacBook Air M1, macOS Monterey 12.3.1, unixodbc installed on opt/homebrew from homebrew...

The connection string is:

sqlDriver <- 'Oracle 19 ODBC driver'

connectionStringSQL <- paste0(
  "Driver=", sqlDriver, 
  ";Server=", sqlServer, 
  ";Database=", sqlDatabase, 
  ";Uid=", sqlUser,
  ";Pwd=", sqlPassword,
  ";Encrypt=yes",
  ";Port=1521")

conn <- odbcDriverConnect(connectionStringSQL)

But I don't think the connection string matters, because the error I get is:

Warning messages:
1: In odbcDriverConnect(connectionStringSQL) :
  [RODBC] ERROR: state 01000, code 0, message [unixODBC][Driver Manager]Can't open lib 'arch -x86_64 /Users/*****/instantclient/libsqora.dylib.19.1' : file not found
2: In odbcDriverConnect(connectionStringSQL) : ODBC connection failed
  • In the error message I pasted the error code with the arch string, but it happens the same without it – Matheus Pacheco de Andrade Apr 29 '22 at 14:41
  • 2
    My understanding from reading e.g. [this post on getting python+oracle on M1 silicon](https://developers.ascendcorp.com/how-to-install-oracle-instant-client-on-apple-silicon-m1-24b67f2dc743) is that your M1 apps can't use x86 libraries. I think you'll need to install an x86 version of R (ie, `arch -x86_64 brew install r`) to use the x86 oracle libraries. Alternately you could use an x86 VM for everything? – kfinity Apr 29 '22 at 16:02
  • Oh, it makes complete sense. Before delving in a VM will try to use a x86 R implementation. Thank you so much for your time, @kfinity. – Matheus Pacheco de Andrade Apr 29 '22 at 19:16

0 Answers0