Roracle A Brief introduction:
Roracle This is the R connection to the access Oracle database DBI (Oracledatabase interface) interface. This is a DBI-compliant Oracle driver based on OCI.
See instructions: http://cran.r-project.org/web/packages/ROracle/ROracle.pdf
Installing Roracle under Linux is easier. Only need to use Install.packages ("Roracle") can be, under Windows to be installed through the source code.
Installation source files:
Http://cran.rstudio.com/src/contrib/ROracle_1.1-11.tar.gz
Win7 in the R installation Roracle method:
environment variable settings:
Setoci_lib64=e:\app\licz\product\11.2.0\dbhome_1\bin
Setoci_inc=e:\app\licz\product\11.2.0\dbhome_1\oci\include
Set path=c:\programfiles\r\r-3.1.1\bin\x64
Attention:
Assuming that the R 64bit version number is installed, then the Oracle client is also a 64-bit version number
Installation steps:
Open R
C:\users\licz>r
>install.packages ("roracle", type = "source")
Trying URL ' http://cran.rstudio.com/src/contrib/ROracle_1.1-11.tar.gz '
Content type ' application/x-gzip ' length 226769 bytes (221 Kb)
Opened URL
Downloaded 221 Kb
* Installing *source* package ' roracle ' ...
* * Successfully unpack and MD5 the ' roracle ' package and check
Cygwin Warning:
MS-DOS Style path Detected:e:\app\licz\product\11.2.0\dbhome_2\bin
Preferred POSIX equivalent Is:/cygdrive/e/app/licz/product/11.2.0/dbhome_2/bin
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user ' s Guide to more detailsabout POSIX paths:
Http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Oracle Client Shared library64-bit-11.2.0.3.0 Operating in oracle_home environment.
Found Oracle Cliente:\app\licz\product\11.2.0\dbhome_2\bin
Found Oracle Client includee:\app\licz\product\11.2.0\dbhome_2\oci\include
Copying Frome:\app\licz\product\11.2.0\dbhome_2\oci\include
* * Libs
Warning: This package has a non-empty ' configure.win ' file,
So building only the Mainarchitecture
Cygwin Warning:
MS-DOS Style path detected:c:/progra~1/r/r-31~1.1/etc/x64/makeconf
Preferred POSIX equivalent is:/cygdrive/c/progra~1/r/r-31~1.1/etc/x64/makeconf
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user ' s Guide to more detailsabout POSIX paths:
Http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Gcc-m64-i "C:/progra~1/r/r-31~1.1/include"-dndebug-i./oci-i "D:/rcompile/cranpkg/extralibs64/local/include"-o2-w All-std=gnu99-mtune=core2-c Rodbi.c-o RODBI.O
Gcc-m64-i "C:/progra~1/r/r-31~1.1/include"-dndebug-i./oci-i "D:/rcompile/cranpkg/extralibs64/local/include"-o2-w All-std=gnu99-mtune=core2-c Rooci.c-o ROOCI.O
In file included fromc:/progra~1/r/r-31~1.1/include/r.h:50:0,
From Rodbi.h:38,
From rooci.c:64:
C:/progra~1/r/r-31~1.1/include/r_ext/rs.h:45:0:warning: "ERROR" redefined [enabled by default]
C:\rtools\gcc-4.6.3\bin\. /lib/gcc/i686-w64-mingw32/4.6.3/. /.. /.. /.. /i686-w64-mingw32/include/wingdi.h:70:0:note:this is the location of the previous definition
Gcc-m64-shared-s-static-libgcc-o ROracle.dll tmp.def rodbi.o rooci.o e:\app\licz\product\11.2.0\dbhome_2\bin/ Oci.dll-ld:/rcompile/cranpkg/extralibs64/local/lib/x64-ld:/rcompile/cranpkg/extralibs64/local/lib-lc:/progra~1 /r/r-31~1.1/bin/x64-lr
Installing to C:/programfiles/r/r-3.1.1/library/roracle/libs/x64
* * R
* * Inst
* * Preparing package for lazyloading
Creating a generic function for ' summary ' from the package ' base ' in the package ' roracle '
* * Help
Installing Help Indices
* * Building Package Indices
* * Testing if installed Packagecan be loaded
* Done (Roracle)
The downloaded source Packagesare in
' C:\Users\licz\AppData\Local\Temp\RtmpAjzrhP\downloaded_packages '
Roracle Package Use:
>Library (roracle)
Load Required thread Bundle: DBI
# Connect to local Oracle database
> Con <-dbconnect (drv,username = "Scott", Password = "Tiger")
> rs <-dbsendquery (Con, "select * from emp where deptno = 10")
> Data <-Fetch (RS)
> Data
EMPNO ename JOB MGR hiredate SAL COMM DEPTNO
1 7782 CLARK MANAGER 7839 1981-06-092450 NA 10
2 7839 KING President na 1981-11-175000 na 10
3 7934 MILLER Clerk 7782 1982-01-23 1300 NA 10
> Dim (data)
[1] 3 8
# Connect to a remote Oracle database
> DRV <-dbdriver ("Oracle")
> connect.string <-"(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 10.1.5.195) (PORT =1521)) (Connect_data = (SERV ER = dedicated) (service_name = cwdb))) "
> Con <-dbconnect (drv,username = "Scott", Password = "Tiger",
+ dbname = connect.string)
> rs <-dbsendquery (Con, "select * from emp where deptno = 10")
> Data <-Fetch (RS)
> Data
EMPNO ename JOB MGR hiredate SAL COMM DEPTNO
1 7782 CLARK MANAGER 7839 1981-06-092450 NA 10
2 7839 KING President na 1981-11-175000 na 10
3 7934 MILLER Clerk 7782 1982-01-23 1300 NA 10
> Dim (data)
[1] 3 8
Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.
Windows next roracle installation and use