[R-SIG-Mac] Can't make odbc FreeTDS connections in R.app, can with RStudio, /usr/local/bin/R, Rscript

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Wed Aug 11 22:55:06 CEST 2021


Joey,

it is hard to say - it could be a bug in the driver. I would recommend using lldb to find the trace so you know where it happens - it would be anywhere from the odbc package, odbc library or the driver. If there is a difference, also check if you are loading the same versions of packages in each (cf .libPaths()) and which libraries are used. You could use JDBC with jTDS instead to see if that works better (or a native driver if it exists).

Cheers,
Simon



> On 12/08/2021, at 5:31 AM, Joey Reid via R-SIG-Mac <r-sig-mac using r-project.org> wrote:
> 
> I’m experiencing some weirdness with database connections using R 4.1 on macOS 11.5.1 and the `odbc` package with the FreeTDS driver. I can replicate the problem on my coworker’s Mac with R 4.0 (macOS 11, not sure which version). 
> 
> Running this code works fine on the command line (or with RStudio, /usr/local/bin/R), /usr/local/bin/Rscript -e “library(odbc); con = dbConnect(odbc(), 'GISLibrary'); dbGetQuery(con, ‘select 1 num’); dbDisconnect(con)”
> 
> But the connection fails with the exact same code in R.app (I’ve tried R.app rev 7976 and 7982). I often get a segfault, like "address 0x7f975f481cb0, cause 'memory not mapped’”. The connection works fine with the ODBC Driver 17 for SQL Server in all execution environments.
> 
> The connection also fails in some environments (rmarkdown::render, Rscript -e) if I load the package sf before making the first connection attempt, e.g., Rscript -e "library(odbc); library(sf);  con = dbConnect(odbc(), 'GISLibrary'); dbGetQuery(con, 'select 1 num'); dbDisconnect(con);". If I delay loading sf until after I’ve successfully made a connection with the FreeTDS driver I can continue to make connections.
> 
> I saw the recent post about breaking ABI changes in the Rcpp package, so I followed the instructions to re-install all packages that depend on Rcpp. That did not solve the problem.
> 
> Thanks,
> 
> Joey Reid
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list