Windows下一个ROracle安装与使用
ROracle一个简短的引论:
ROracle这是R连接到接入Oracle数据库DBI(Oracledatabase interface)介面。这是基于OCI一个DBI兼容Oracle司机.
具体见说明书:http://cran.r-project.org/web/packages/ROracle/ROracle.pdf
在Linux下安装ROracle比較简单。仅仅须要用install.packages("ROracle")就可以,在windows下要通过源代码安装。
安装源文件下载地址:
http://cran.rstudio.com/src/contrib/ROracle_1.1-11.tar.gz
Win7中R安装ROracle方法:
环境变量设置:
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
注意:
假设安装的的R 64bit版本号,那么oracle client也要是64位版本号
安装步骤:
打开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' ...
** 成功将'ROracle'程序包解包并MD5和检查
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 for 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
警告: 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 for 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 -Wall -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 -Wall -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 package 'base' in 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包使用:
>library(ROracle)
加载须要的程辑包:DBI
# 连接本地Oracle数据库
> 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
# 连接远程Oracle数据库
> drv <-dbDriver("Oracle")
> connect.string <-"(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.5.195)(PORT =1521)) (CONNECT_DATA = (SERVER = 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
版权声明:本文博客原创文章。博客,未经同意,不得转载。
Windows下一个ROracle安装与使用的更多相关文章
- Windows下的Memcache安装 linux下的Memcache安装
linux下的Memcache安装: 1. 下载 memcache的linux版本,注意 memcached 用 libevent 来作事件驱动,所以要先安装有 libevent. 官方网址:http ...
- Windows下的Memcache安装
Windows下的Memcache安装: 1. 下载memcache的windows稳定版,解压放某个盘下面,比如在c:\memcached2. 在终端(也即cmd命令界面)下输入 'c:\memca ...
- Windows下 VM12虚拟机安装OS X 10.11 和VM TOOLS
Windows下虚拟机安装Mac OS X —– VMware Workstation12安装Mac OS X 10.11 本文即将介绍WIN虚拟MAC的教程.完整详细教程(包含安装中的一些问题) [ ...
- coreseek实战(一):windows下coreseek的安装与测试
coreseek实战(一):windows下coreseek的安装与测试 网上关于 coreseek 在 windows 下安装与使用的教程有很多,官方也有详细的教程,这里我也只是按着官方提供的教程详 ...
- Windows下Memcache的安装与在php中使用
memcache dll插件和测试例子下载地址: http://pecl.php.net/package/memcache Windows下Memcache的安装方法 Memcached官方:http ...
- Windows下的Memcache安装与测试教程
Windows下的Memcache安装 1.下载memcache for windows. 下载地址:http://splinedancer.com/memcached-win32/,推荐下载bina ...
- Mysql在windows下的免安装配置步骤和重新安装的步骤
windows下mysql免安装配置 1. 下载mysql免安装压缩包 下载mysql-5.6.22-winx64.zip 解压到本地D:\mysql-5.6.22-winx64 2. 修改配置文件 ...
- DEDECMS最新5.7版在Windows下的Memcache安装
一,织梦后台后台设置进入系统后台,在[系统基本参数]下面的"性能选项"卡当中,关于memcache进行如下配置: cfg_memcache_enable : 是否启用memcach ...
- Windows下的Memcache安装:
Windows下的Memcache安装:1. 下载memcache的windows稳定版,解压放某个盘下面,比如在c:\memcached2. 在终端(也即cmd命令界面)下输入 'c:\memcac ...
随机推荐
- PHP redis操作类 个人总结
<pre name="code" class="php"><span style="font-size:18px;"> ...
- 《学习opencv》笔记——矩阵和图像处理——cvMax,cvMaxS,cvMerge,cvMin and cvMinS
矩阵和图像操作 (1)cvMax函数 其结构 void cvMax(//比較两个图像取最大值 const CvArr* src1,//图像1 const CvArr* src2,//图像2 CvArr ...
- Chapter06-Phylogenetic Trees Inherited(POJ 2414)(减少国家DP)
Phylogenetic Trees Inherited Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 480 Accepted ...
- bsh for android : 北京
beanshell : bjtime.bsh source("/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh" ...
- zepto.js 源码注释备份
/* Zepto v1.0-1-ga3cab6c - polyfill zepto detect event ajax form fx - zeptojs.com/license */ ;(funct ...
- Sonar Qube QA
配置:1.配置环境变量 SONAR_RUNNER_HOME2.配置path :增加%SONAR_RUNNER_HOME%\bin3.在自己的本地项目的根目录下创建 sonar-project.pro ...
- .NET单元测试艺术(3) - 使用桩对象接触依赖
List 3.1 抽取一个设计文件系统的类,并调用它 [Test] public bool IsValidLogFileName(string fileName) { FileExtensionMan ...
- iOS UISearchDisplayController学习笔记
UISearchDisplayController和UISearchBar一起使用用来管理UISearchBar和搜索结果的展示.UISearchDisplayController提供了显示搜索结果的 ...
- C++ Primer 学习笔记_43_STL实践与分析(17)--再谈迭代器【中】
STL实践与分析 --再谈迭代器[中] 二.iostream迭代[续] 3.ostream_iterator对象和ostream_iterator对象的使用 能够使用ostream_iterator对 ...
- 工作介绍xml书包文件
光开放平台一个非常重要的特点就是简化了对xml文件的操作,您能非常轻松地引入xml文件.定位到随意节点.增删属性和文本以及节点本身,以下咱们用实例来介绍对xml的操作 引入xml文件: <cht ...