I recently installed R 4.2.0 and RStudio 2022.02.2 Build 485 on Windows.
Every time I run the RJDBC::JDBC function in RStudio, the R session aborts with "R encountered a fatal error. The session was terminated". In RGui, the function runs fine.
I debugged the JDBC function and have isolated the problem to Sys.getlocale("LC_MESSAGES"). Without fail, in RStudio, when I run Sys.getlocale("LC_MESSAGES"), the R session aborts.
I have tried:
- Installing older versions of RStudio (same error with the last four releases)
- Verified that RStudio and RGui are using the same R executable, using
R.home()
- Restarting the machine
- Checking that Sys.getenv() returns (almost) the same results, as suggested in this stackoverflow answer for a similar question
How do I fix this?