gpt4 book ai didi

r - 将 R DataFrame 插入 SQL Server 表

转载 作者:行者123 更新时间:2023-12-02 17:05:40 24 4
gpt4 key购买 nike

我已经坚持了几天了...我找不到问题所在。我在 Spotfire 中使用 R。我正在尝试将数据框的结果插入到 sql server 2014 表中。这是我正在使用的示例:

install.packages("ODBC")
install.packages("DBI")


library(DBI)
library(odbc)

con <- dbConnect(odbc(),
Driver = "SQL Server",
Server = "ServerName",
Database = "DatabaseName",
UID = "UserName",
PWD = "Password")
dbWriteTable(conn = con,
name = "SQlServerTableDestinationName",
value = Datatable)

我收到这个错误:

TIBCO Enterprise Runtime for R returned an error: 'Error in .loadNamespaceImpl(package, path, keep.source, partial) : error executing useDynLib for dynamic library 'rlang' from package 'rlang' loaded from P:/TERR/x86_64-pc-windows-library/4.2 : Error in library.dynam(chname = chname, package = package, lib.loc = ... : Foreign binary rlang could not be loaded'.

谢谢!

最佳答案

请遵循此处建议的 TIBCO 社区解决方案:https://community.tibco.com/wiki/tibcor-enterprise-runtime-r-fast-writeback-sql-server-2016

在您的情况下,它将类似于以下内容:

dbcon <- RODBC::odbcDriverConnect(connection_string )
RODBC::sqlSave(dbcon, dat = dataf, "SQlServerTableDestinationName")

如果有帮助,请告诉我

关于r - 将 R DataFrame 插入 SQL Server 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51849519/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com