如何在linux下用R语言通过odbc访问oracle

如题所述

第1个回答  2016-01-03
C的话可以通过OCI,c++可以通过OCCI,但是OCCI在VS2010上有个bug不知道解决了没(不过这个bug在Linux下是正常的),好像是从结果集读取字符类型时用getString()有问题。以前的一点经验,希望对你有帮助。本回答被网友采纳
第2个回答  2016-01-28
1:Obtain a package called “RODBC” in order to connect with the database.Download it here: http://cran.r-project.org/web/packages/RODBC/index.html
2:Start R, switch to the location which contains the RODBC package and an enter the following R code:
install.packages(packagename.tar.gz)
3:After the package installation you can create a channel:
ch=odbcConnect("ORACLE2")
4:Check the channel with odbcGetInfo(ch)
5:If the connection was successful, the console shows something like this:
odbcGetInfo(ch)
DBMS_Name DBMS_Ver Driver_ODBC_Ver
"Oracle" "10.02.0010" "03.52"
Data_Source_Name Driver_Name Driver_Ver
"ORACLE2" "SQORA32.DLL" "11.02.0001"
ODBC_Ver Server_Name
"03.52" "143.93.91.33:1521/xe"