How to resolve Fatal error in R when using ODBC and SqlFetch?

,

I am trying to import data from Access into R and get a fatal error. I have run this same query many times in the past without issue. Now it doesn't work anymore. My operating system was recently updated to Windows 11 Pro. I have been able to successfully run this on another machine with Windows 10 Pro. I wonder if it has something to do with the operating system. Below is some relevant information along with code:

Operating system: Windows 11 Pro
64 bit OS
R Studio version: 2022.02.3 Build 492

When I run the script below, I usually get a fatal error. But it has successfully run recently. I don't know why it runs sometimes and not others. I get the following error messages:

R Session Aborted.
R encountered a fatal error.
The session was terminated.
Start new session.

I don't get any other diagnostics or information. Below is the code. It aborts after the SqlFetch command.

rm(list=ls())
library(RODBC)
library(stringr)
library(lubridate)
library(data.table)
library(sqldf)
library(dplyr)
library(tibble)
library(raw)
library(tidyverse)

# specify Access database to import data from 
db <- file.path("db_name.accdb")
    # open ODBC connection to database
channel <- odbcConnectAccess2007(db)
# import tables

x <- sqlFetch(channel, "table_name")

My IT guy has not been able to figure out what the problem is. We uninstalled and reinstalled R and R-studio. After the sqlFetch, the table loads and then aborts. He checked "Event Viewer" and found the "Application Error" with the following information. He suspects it has something to do with the Kernel. We don't know why it is pointing to the system32 folder and if or how to change it.

Faulting application name: rsession-utf8.exe, version: 2022.2.3.0, time stamp: 0x6287ec10
Faulting module name: KERNELBASE.dll, version: 10.0.22621.1635, time stamp: 0x61869dd2
Exception code: 0xc06d007e
Fault offset: 0x000000000006536c
Faulting process id: 0x0x5B24
Faulting application start time: 0x0x1D99AF4146AF196
Faulting application path: C:\Program Files\RStudio\bin\rsession-utf8.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: 349c9da2-fa49-47d1-ab94-4faa29687150
Faulting package full name: 
Faulting package-relative application ID:

Any help would be appreciated. Thanks!

I have exactly the same problem. I have 64 bit ODBC driver for MS Access version 16.00.16501.2009 (ACEODBC.dll). I use Microsoft 365 64 bit (Office). I have Windows 11 Home. I run RStudio 2023.06.0 Build 421. I have R version 4.3.0 (2023-04-21 ucrt) -- "Already Tomorrow". Everything is updated today. I can connect to the database file and get records from a table in the database if I hurry, but after ca 5-10 seconds I get the "R encountered a fatal error" as described above. I cannot disconnect during these seconds. The weird thing is that I have managed to get it to work correctly once with the same configuration. If I run the same script in the R console (RGui) the whole RGui will crash and disappear. My codesnippet for testing is simply this:

library(RODBC)
mdbConnect<-odbcConnectAccess2007("file.mdb")
sql<-"SELECT * from station"
u<-sqlQuery(mdbConnect, sql)
odbcCloseAll()

Any ideas on how to fix or how to debug is very much appreciated!

Depending on the requirements, you may need to dynamically instantiate the provider with the configured settings or update an existing provider instance with the new configuration. This step will vary based on the specific module system or framework you are using.

My problems disappeared after installing Windows Update KB5027303.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.