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()
The documentation at ?locale says LC_MESSAGES is invalid for windows, however i can query it without crashing R, i just get an empty string returned.
It makes me wonder about the database driver you have, if its is OS independent or might perhaps be good for unix only where LC_MESSAGES might be relevant ?
P.s. i dont work with databases in R myself hardly ever so im probably not the best person to help you.