RODBC cannot allocate memory

Simple R script

library(RODBC)
odbChannel <- odbcConnect(dsn = "CTPRD03", uid = "BD_RPT_RO", pwd = "****")
df.test <- sqlQuery(channel = odbChannel, query = "select * from DUAL;")
df.test
close(odbChannel)

      

Throws the following error:

shiny @ narc07shiny1dev: ~ / software> Rscript./RODBC_SIMPLE_TEST.r
Error in odbcQuery (channel request, rows_at_time): "calloc" could not allocate memory (from 18446744073709551616 22816 bytes) Calls: sqlQuery → odbcQuery → .Call Execution halted Warning: closing unused RODBC handle 1



Tested odbc outside R and was able to get results. I'm not sure where the problem is at this point. I think it is RODBC.

Already removed the RODBC and reinstalled the RODBC package and there were no errors during this process but still have the same results.

Found one case with the same problem but there was no resolution. What are the next steps in isolating the problem, any suggestions?

+3


source to share


2 answers


I had a similar problem and fixed it by adding rows_at_time = 1 to the connection.

odbChannel <- odbcConnect(dsn = "CTPRD03", uid = "BD_RPT_RO", pwd = "****", rows_at_time = 1)

      

I also found this ad unit in the documentation:



https://cran.r-project.org/web/packages/RODBC/RODBC.pdf

Several bugs that were listed as bugs in RODBC 1.3-0 were actually ODBC driver bugs that can be worked around by setting rows_at_time = 1 (and the warning under that argument was always there). Drivers involved were third party Oracle drivers and the older SQL Server Drivers.

+6


source


What database architecture are you connecting to? If it doesn't match the version of R you are using, the query will not run. For example, if you are using 64-bit R but trying to connect to a Microsoft Access 2007 or earlier (32-bit) database, you will not be able to run the query.



If you are using R Studio, go to the Tools menu, then Global Options, and you can change the version of R you are using to match your database setup.

0


source







All Articles