Oracle.jl

This package provides a driver to access Oracle databases using the Julia language, based on ODPI-C bindings.

Requirements

Instant Client installation

This package requires Oracle's Instant Client.

To install it, follow these instructions:

  • Download instant client.

  • Unzip and add instantclient folder to your LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=/path-to-folder/instantclient:$LD_LIBRARY_PATH

Check ODPI-C documentation, or Instant Client documentation for alternative installation methods.

libaio is a dependency of Instant Client.

If you have root access to your machine, you can install it using the package manager, as in:

yum -y install libaio

If you don't have root access to your machine, you can compile it from source and set your LD_LIBRARY_PATH environment variable to point to the library.

The compilation can be done using the following script:

wget https://pagure.io/libaio/archive/libaio-0.3.111/libaio-libaio-0.3.111.tar.gz
tar xf libaio-libaio-0.3.111.tar.gz
cd libaio-libaio-0.3.111
make prefix=$HOME/local
make install prefix=$HOME/local

Then add the following to your shell profile ($HOME/.bashrc):

export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH

Package installation

julia> Pkg.add("Oracle")

Installation on Jupyter environment

When loading this package on a Jupyter Notebook environment you might get this error:

InitError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory"

First, check that the package loads outside the Jupyter environment. If it does work, than the problem is that LD_LIBRARY_PATH is not set in the Jupyter environment.

To solve this, edit your kernel.json file, usually located at ~/.local/share/jupyter/kernels/julia-v where v is the Julia version, and add an environment variable for your LD_LIBRARY_PATH, as in the following example, where /myhomedir/local/instantclient is the location for the instant client library.

{
  "display_name": "Julia 1.1.0",
  "argv": [
    "env",
    "LD_LIBRARY_PATH=/myhomedir/local/instantclient",
    "/myhomedir/local/julia-1.1.0/bin/julia",
    "-i",
    "--startup-file=yes",
    "--color=yes",
    "--project=@.",
    "/myhomedir/.julia/packages/IJulia/gI2uA/src/kernel.jl",
    "{connection_file}"
  ],
  "language": "julia",
  "env": {},
  "interrupt_mode": "signal"
}

The LD_LIBRARY_PATH environment variable must be set before the Julia process starts. This is why you can't just set this variable inside the Jupyter notebook.

Source Code

The source code for this package is hosted at https://github.com/felipenoris/Oracle.jl.

License

The source code for the package Oracle.jl is licensed under the MIT License.

During installation, Oracle.jl downloads the source code and compiles the library ODPI-C which is licensed under The Universal Permissive License (UPL), Version 1.0 and/or the Apache License.