Windows下ROracle安裝及使用

2021-06-26 18:15:57 字數 3856 閱讀 5952

roracle簡介:

roracle是r連線訪問oracle資料庫乙個dbi(oracledatabase inte***ce)介面,這是乙個基於oci的乙個dbi相容的oracle驅動程式.

詳細說明見:

在linux下安裝roracle比較簡單,只需要用install.packages("roracle")即可,在windows下要通過原始碼安裝。

win7中r安裝roracle方法:

設定環境變數:

set path=c:\programfiles\r\r-3.1.1\bin\x64

注意:如果安裝的的r 64bit版本,那麼oracle client也要是64位版本

安裝步驟:

開啟rc:\users\licz>r

>install.packages("roracle",type = "source")

trying url''

opened url

downloaded 221 kb

* installing *source* package'roracle' ...

** 成功將'roracle'程式包解包並md5和檢查

cygwin warning:

cygwin environment variable option"nodosfilewarning" turns off this warning.

consult the user's guide for more detailsabout posix paths:

oracle client shared library64-bit - 11.2.0.3.0 operating in oracle_home environment.

** 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:

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

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

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

linux下安裝roracle包

windows下CoffeeScript 的實現

安裝coffeescript,需要先安裝node.js和npm。在mac 和 linux 的環境下,coffeescript的安裝是相當容易的。比較複雜的呢是在windows的環境下安裝。所以我們著重講一下在windows環境下的安裝方式。安裝完node 包括npm 後,我們到programm fi...

windows下python twisted庫安裝

方式 一 命令列中執行easy instal twisted 提示 unable to find vcvarsall.bat 的錯誤,這是因為twisted源 安裝方式,需要c編譯環境,如果有安裝vc開發環境就可以通過 plain view plain copy 首先安裝mingw,在mingw的安...

Windows下chromedriver安裝與配置

chromedriver 谷歌瀏覽器驅動 谷歌瀏覽器 幫助 關於 chrome 注意 chromedriver 的版本要和 chrome 瀏覽器相對應,不然很多功能不能用 從selenium中匯入webdriver from selenium import webdriver 建立乙個瀏覽器驅動 e...