Search code examples
roracle

ROracle.dll is not a valid Win32 application


It's a tale as old as ROracle... I just can't seem to find a solution to this problem. I've uninstalled JAVA, R, and RTools and reinstalled all 3 with only 64bit versions. The build for ROracle goes fine, but I get the following error message when trying to load the package.

I've looked at some of the other solutions without success and verified a 64 bit install of Oracle Client. Thoughts?

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

Error: package or namespace load failed for ‘ROracle’


Solution

  • Turned out that the IT department pushed a 32bit build of Oracle client instead of 64bit. If you get this message, all the paths are correct, and you're sure you are using 64 bit R/Java, then try building in 32bit mode.

    Here is a present to ROracle users to make up for this silly post: This is the install script I am passing around within my facility to facilitate the process, thought others might find it useful. We are using windows 7, some have x64. All are using 32bit Oracle Client.

    # First install RTools w/ path modifications during the install
    # Verify file paths
    filePathofPackage <- "YOUR/FILE/PATH/ROracle_1.3-1.tar.gz"
    if(Sys.getenv("R_ARCH") != "/i386") stop("Process must be run in 32bit version of R")
    Sys.setenv(OCI_LIB32 = "C:\\Oracle\\product\\11.2.0\\client_1\\bin")
    Sys.setenv(OCI_INC = "C:\\Oracle\\product\\11.2.0\\client_1\\oci\\include")
    install.packages(filePathofPackage, repos = NULL, verbose = T, clean = T)