Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
901 views
in Technique[技术] by (71.8m points)

r - RODBC to connect to SQL Server on Mavericks

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

specifically I want to:

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

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

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.

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.

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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.

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

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...