本文介绍了使用DBI连接到MSSQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用DBI包连接到MSSQL.我正在尝试包装中显示的方式

I can not connect to MSSQL using DBI package.I am trying the way shown in package itself

    m <- dbDriver("RODBC") # error

错误:找不到函数"RODBC"

Error: could not find function "RODBC"

    # open the connection using user, passsword, etc., as
    # specified in the file \file{\$HOME/.my.cnf}
    con <- dbConnect(m, dsn="data.source", uid="user", pwd="password"))

任何帮助表示赞赏.谢谢

Any help appreciated. Thanks

推荐答案

似乎曾经有一个用于DBI的RODBC驱动程序,但现在没有了:

It looks like there used to be a RODBC driver for DBI, but not any more:

http://cran.r-project.org/src/contrib/Archive/DBI.RODBC/

需要一些调整才能将其安装在版本3 R中,但是我没有任何ODBC源可以对其进行测试.但是m = dbDriver("RODBC")不会出错.

A bit of tweaking has got this to install in a version 3 R but I don't have any ODBC sources to test it on. But m = dbDriver("RODBC") doesn't error.

> m = dbDriver("RODBC")
> m
<ODBCDriver:(29781)>
>

建议您在R-sig-db邮件列表上询问,也许可以找出这段代码和/或作者发生了什么...

Suggest you ask on the R-sig-db mailing list to maybe find out what happened to this code and/or the author...

这篇关于使用DBI连接到MSSQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 07:52