2

I looked everywhere and followed the exact instructions provided, but run into this error when I load the library on my Windows 7 machine:

Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared object 'C:/Program Files/R/R-3.2.3/library/ROracle/libs/x64/ROracle.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

Error: package or namespace load failed for ‘ROracle’

Here is my R version:

platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          2.3                         
year           2015                        
month          12                          
day            10                          
svn rev        69752                       
language       R                           
version.string R version 3.2.3 (2015-12-10)
nickname       Wooden Christmas-Tree       

I downloaded the ROracle binary for Windows from this page: http://www.oracle.com/technetwork/database/database-technologies/r/roracle/downloads/index.html

I used the ROracle 1.2-1 version.

My OCI_LIB64 and PATH environmental variables are as follows:

OCL_LIB64=C:\Oracle\product\11.2.0\client_1\bin
PATH:C:\Oracle\product\11.2.0\client_1;C:\Oracle\product\11.2.0\client_1\bin

Anything else I am missing? How can I get this to work?

I have administrator rights to all the folders, including the library paths.

4

2 回答 2

0

您需要安装 Oracle Instant Client 来修复此错误,如https://docs.oracle.com/cd/E67822_01/OREAD/apx_typicalinstall.htm#OREAD274所示。

您的 OCL_LIB64 和 PATH 变量指向某种 \bin 目录,而它们应该指向 Instant Client 解压缩目录(在我的例子中没有 \bin)。

于 2017-09-25T13:41:03.047 回答
0

您需要将 Oracle Client 32 和 64 位 witk SDk 文件夹目录添加到 Windows 系统环境变量路径。还需要安装 rjava 包(安装 java 64 位)并在 R sys.setenv() 中设置 JAVA_HOME。

install.packages("rJava")       #Install Java 64 bits
library(rJava)                  #Not Errors

Sys.setenv("OCI_LIB64"="C:/instantclient_12_2_64bits")
Sys.setenv("OCI_LIB32" = "C:/instantclient_12_2_64bits")
Sys.setenv("ORACLE_HOME" = "C:/instantclient_12_2_64bits")

Sys.setenv(JAVA_HOME='C:/Program Files/Java/jre1.8.0_241')

install.packages(paste0(path,"/ROracle_1.3-1.tar.gz"), repos = NULL, type = "source")
library(ROracle)

安装过程中的最后一条消息应该是 DONE!

在 Windows 系统环境路径中:

C:\instantclient_12_2_64bits;
C:\instantclient_12_2_64bits\sdk;
C:\instantclient_12_2_32bits;
C:\instantclient_12_2_32bits\sdk;

希望这有效!

于 2020-04-02T04:21:21.527 回答