Download ROracle
http://www.oracle.com/technetwork/database/database-technologies/r/roracle/downloads/index.html
set the following Windows variables, according to your installation
OCI_INC = C:\Oracle11_201\product\11.2.0\dbhome_1\OCI\include
OCI_LIB64 = C:\Oracle11_201\product\11.2.0\dbhome_1\BIN
Install ROracle in a CMD window
C:\Users\user\Documents>"C:\Program Files\R\R-3.2.2\bin\r" CMD INSTALL ROracle_1.2-1.zip
In RStudio
> library(ROracle)
Error: package ‘DBI’ required by ‘ROracle’ could not be found
> install.packages("DBI")
Installing package into ‘C:/Users/karatrj1/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/DBI_0.3.1.zip'
Content type 'application/zip' length 162723 bytes (158 KB)
downloaded 158 KB
package ‘DBI’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\karatrj1\AppData\Local\Temp\RtmpMJUGgr\downloaded_packages
> library(DBI)
> library(ROracle)
Testing the connection and querying the DB
> drv <- dbDriver("Oracle")
> con <- dbConnect(drv, username ="rquser", password = "rquser", dbname="dbname or connect string")
> dbGetQuery(con, "select * from dual")
DUMMY
1 X
Succesfully connected to Oracle in RStudio!
Comments
Post a Comment