RODBC query falsely returning zero rows

淺唱寂寞╮ 提交于 2019-12-04 06:46:41

问题


I have come across similar posts, but my issue looks different. I haven't been able to fix the results to these queries with "rows_at_time=1" or "believeNRows = False".

I am trying to connect to an Oracle database using RODBC within R. I am able to connect to the database, but I am not retrieving any data, except the column headings. For example I will have zero observations on 18 variables from one table. I do this at work on my PC all the time, but am trying to do this on my macbook pro at home.

Below is the connection code

db<-odbcConnect(dsn="DW", uid="XXXXXX", pwd="XXXXX", rows_at_time = 1, believeNRows=FALSE)

Here is some odbc info:

> odbcGetInfo(db)
       DBMS_Name         DBMS_Ver  Driver_ODBC_Ver Data_Source_Name      Driver_Name       Driver_Ver         ODBC_Ver      Server_Name 
        "Oracle"     "11.01.0000"          "03.00"               ""     "atoradb.so"         "3.1.12"     "03.52.0000"               "" 

As you can see the dsn name and the server name are blank.

Here is my session info:

R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.ISO8859-1/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RSQLite_0.11.4 DBI_0.3.1      RODBC_1.3-10  

loaded via a namespace (and not attached):
[1] tools_3.1.1

EDIT

Here is one of many queries I am running:

cal <-sqlQuery(db,"select * from d_calendar")

This results in 3 observations from 18 variables, when there are 19,401 observations in total.

来源:https://stackoverflow.com/questions/26127433/rodbc-query-falsely-returning-zero-rows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!