positron icon indicating copy to clipboard operation
positron copied to clipboard

R crashes when connecting to Oracle database via odbc

Open simonpcouch opened this issue 1 year ago • 3 comments

Positron Version:

Positron Version: 2024.07.0 (Universal) build 59

Steps to reproduce the issue:

  1. Create a connection to an Oracle database via odbc in RStudio—MacOS ARM64, Oracle's driver (rather than Posit's Pro Driver). My setup reflects https://github.com/r-dbi/odbc/pull/829, with code:
library(odbc)

con <- dbConnect(
  odbc(), 
  dsn = "Oracle", 
  DBQ = "db", 
  UID = "test", 
  PWD = "odbc"
)
  1. Use the same code to connect in Positron, observe "R 4.3.3 exited unexpectedly and was automatically restarted. You may have lost unsaved work. Exit code: 139."

What did you expect to happen?

Successful connection to the database.

One piece of information I'm looking into at the moment: Oracle connections depend on a few environmental variables being properly set, and I see a difference in the values of those envvars between RStudio and Positron sessions. In RStudio, I see:

Sys.getenv("LD_LIBRARY_PATH")
#> [1] "/Users/simoncouch/instantclient_23_3"
Sys.getenv("PATH")
#> [1] "/Users/simoncouch/instantclient_23_3:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/gfortran/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/TeX/texbin:/Applications/quarto/bin:/Users/simoncouch/.local/bin:/usr/texbin:/Applications/RStudio.app/Contents/Resources/app/bin/postback"
Sys.getenv("OCI_INC_DIR")
#> [1] ""
Sys.getenv("OCI_LIB_DIR")
#> [1] ""

Created on 2024-07-17 with reprex v2.1.0

PATH and LD_LIBRARY_PATH are set in my global .Rprofile.

In Positron, I see:

Sys.getenv("LD_LIBRARY_PATH")
#> [1] "/Users/simoncouch/instantclient_23_3"
Sys.getenv("PATH")
#> [1] "/Users/simoncouch/instantclient_23_3:/Users/simoncouch/.pyenv/versions/3.10.4/bin:/Users/simoncouch/instantclient_19_6:/opt/homebrew/opt/protobuf@21/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/gfortran/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/TeX/texbin:/Applications/quarto/bin:/Users/simoncouch/.local/bin:/Users/simoncouch/.local/bin"
Sys.getenv("OCI_INC_DIR")
#> [1] "/Users/simoncouch/instantclient_19_6/sdk/include"
Sys.getenv("OCI_LIB_DIR")
#> [1] "/Users/simoncouch/instantclient_19_6"

In both the PATH and OCI_*, there are old Instant Client installations that don't exist anymore.

In RStudio, I have:

dbGetInfo(con)
#> $dbname
#> [1] ""
#> 
#> $dbms.name
#> [1] "Oracle"
#> 
#> $db.version
#> [1] "19.00.0000"
#> 
#> $username
#> [1] "test"
#> 
#> $host
#> [1] ""
#> 
#> $port
#> [1] ""
#> 
#> $sourcename
#> [1] "Oracle"
#> 
#> $servername
#> [1] "db"
#> 
#> $drivername
#> [1] "SQORA32.DLL"
#> 
#> $odbc.version
#> [1] "03.52"
#> 
#> $driver.version
#> [1] "23.03.00239"
#> 
#> $odbcdriver.version
#> [1] "03.52"
#> 
#> $supports.transactions
#> [1] TRUE
#> 
#> $supports.catalogs
#> [1] FALSE
#> 
#> $supports.schema
#> [1] TRUE
#> 
#> $getdata.extensions.any_column
#> [1] TRUE
#> 
#> $getdata.extensions.any_order
#> [1] TRUE

Created on 2024-07-17 with reprex v2.1.0

Were there any error messages in the Output panel or Developer Tools console?

Yes—GitHub is showing "There was an error creating your Issue: body is too long (maximum is 65536 characters)," so I just pasted the logs in this gist. :)

simonpcouch avatar Jul 17 '24 14:07 simonpcouch