RODBC连接到Mavericks上的SQL Server

问题描述:

我可以在OSX 10.9.2 Mavericks上使用RODBC连接到SQL Server(免费)吗?

Can I use RODBC on OSX 10.9.2 Mavericks to connect to a SQL Server (for free)?

我具体要:

    dB <- odbcConnect("dataBase",pwd="password",uid="userID")
    t <- sqlQuery(dB,"SELECT * FROM myTable")

但是odbcConnect一遍又一遍地抛出此警告,并且永远不会返回...

but odbcConnect throws this warning over and over and never returns...

    50: In odbcDriverConnect("DSN=dataBase;UID=userID;PWD=password") : [RODBC] ERROR: state IM002, code 1408279968, message [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded

坦白地说,由于我没有免费的SQL Server驱动程序,因此我尚未使用具有正确DSN的iODBC来设置DSN.

Now to be honest, I haven't set up the DSN with iODBC with the right DSN because I don't have a free SQL Server driver.

少数人报告使用RODBC在OSX 10.9.2 Mavericks下连接到SQL Server有点晦涩.没有命名驱动程序,也没有提到它们是手动编译RODBC或iODBC的.

The few people who report using RODBC to connect to SQL Server under OSX 10.9.2 Mavericks have been a bit obscure. Not naming drivers, or mentioning that they compiled RODBC or iODBC by hand.

更新:现在就以下问题进行讨论: 在OS X优胜美地上安装RODBC 在OS X Mavericks上安装RODBC/ROracle软件包

Update: thread now on these questions: Installation of RODBC on OS X Yosemite and Installation of RODBC/ROracle packages on OS X Mavericks

目前比平常需要更多工作的唯一原因是,还没有Mavericks的RODBC二进制文件.

The only reason this requires more legwork at the moment than usual is that there isn't (yet) an RODBC binary for Mavericks.

即使如此,您需要驱动程序并设置DSN.我一直在使用Actual Technologies的驱动程序(不是免费的),并对它们感到非常满意.否则,您将不得不从源代码下载并编译iODBC或unixODBC.

Even so, you will need a driver and to set up a DSN. I have always used the drivers from Actual Technologies (not free) and have been very happy with them. Otherwise you'll have to download and compile iODBC or unixODBC from source.

但是,您仍然需要编译RODBC表单源,这将需要iODBC头文件,Apple显然不再提供该头文件.

However, you'll still need to compile RODBC form source, and that will require the iODBC header files, which Apple apparently no longer supplies.

如果下载最新的iODBC源,然后将搜索路径设置为源的位置,或者只是将头文件放在/usr/include中,而libiodbc.a文件放在/usr/lib中.然后,您应该能够从源代码编译RODBC.

If you download the latest iODBC source and then either set your search paths to the location of the sources, or simply place the header files in /usr/include and the libiodbc.a file in /usr/lib. Then you should be able to compile RODBC from source.

最后,除了暂时缺乏针对RODBC的Mavericks二进制文件的麻烦之外,所有这些在RODBC插图中都有令人难以置信的详细说明.

Finally, aside from the temporary hiccup regarding the lack of a Mavericks binary for RODBC, all of this is explained in incredible detail in the RODBC vignette.