Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
找不到函数‘;的继承方法;dbWriteTable’;签字‘&引用;RODBC"&引用;字符“&引用;数据框“’;_R_Sql Server_Socrata - Fatal编程技术网

找不到函数‘;的继承方法;dbWriteTable’;签字‘&引用;RODBC"&引用;字符“&引用;数据框“’;

找不到函数‘;的继承方法;dbWriteTable’;签字‘&引用;RODBC"&引用;字符“&引用;数据框“’;,r,sql-server,socrata,R,Sql Server,Socrata,我试图通过一个api调用提取数据,另存为r数据帧,然后将r数据帧复制到MS Sql server。api调用和与Sql server的连接工作正常。但是,每当我尝试将r数据帧复制到sql server时,都会收到一条错误消息。我已经尝试了我找到的所有选择,但没有任何效果。感谢您的帮助 library(RSocrata) REData <- read.socrata("https://data.ny.gov/resource/i8hd-gucs.json", app_token = toke

我试图通过一个api调用提取数据,另存为r数据帧,然后将r数据帧复制到MS Sql server。api调用和与Sql server的连接工作正常。但是,每当我尝试将r数据帧复制到sql server时,都会收到一条错误消息。我已经尝试了我找到的所有选择,但没有任何效果。感谢您的帮助

library(RSocrata)
REData <- read.socrata("https://data.ny.gov/resource/i8hd-gucs.json", app_token = token, email = "email", 
                   password = password,
                   stringsAsFactors = FALSE)


DBI::dbWriteTable(con, name = "tblDosActiveRealEstateSalesAgent", 
data.frame(REData), field.types = NULL, row.names = FALSE, append = TRUE, 
              allow.keywords = FALSE)


 Error in (function (classes, fdef, mtable)  : 
 unable to find an inherited method for function ‘dbWriteTable’ for signature ‘"RODBC", "character", "data.frame"’

require(RODBC)
con <- odbcDriverConnect("Driver=ODBC Driver 13 for SQL Server;server=172.xx.xx.xx,1433;Database=ReportServer;uid=sa;Pwd=password")

如果您是因为试图将MS SQL与R和DBI结合使用而来到这里,这可能会有所帮助:

我的问题是DBI的方法在对象标识符周围添加引号。将QUOTED_IDENTIFIER设置为ON解决了此问题


dbExecute(myConnection,“将标识符设置为on”)

您的
sessionInfo()
显示了什么?您是否已装入
RODBC
包?你是如何定义con的?@MrFlick我在上面添加了会话信息和con字符串。谢谢你看这个
R version 3.4.3 (2017-11-30)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] RSQLite_2.1.0    jsonlite_1.5     RSocrata_1.7.4-7 odbc_1.1.5       RODBC_1.3-15    

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.16    digest_0.6.13   mime_0.5        plyr_1.8.4      R6_2.2.2        DBI_0.8         httr_1.3.1      rlang_0.2.0     curl_3.2       
[10] blob_1.1.1      tools_3.4.3     bit64_0.9-7     bit_1.1-12      hms_0.4.2       yaml_2.1.18     compiler_3.4.3  pkgconfig_2.0.1 memoise_1.1.0