Page Contents

loopback-oracle-installer

The Oracle connector version 3.0.0 or above depends on the oracledb module as the Node.js driver for Oracle databases. Since oracledb is a C++ add-on, the installation requires C++ development tools to compile and build the module from source code. For more information, see Installing compiler tools.

At runtime, strong-oracle also requires dynamic libraries from  Oracle Database Instant Client.

The loopback-oracle-installer module takes care of the binary dependencies and simplifies the whole process.  

The installer automatically downloads and extracts the prebuilt oracledb to the /loopback-connector-oracle/node_modules directory and Oracle Database Instant Client into <UserHomeDirectory>/oracle-instant-client. If a prebuilt bundle does not exist for your client platform and Node version, the installer prompts you to install Oracle prerequisites. For more information, see Installing node-oracledb.

Once you’ve installed the Oracle prerequisites, re-install the Oracle connector by entering following command:

$ npm install loopback-connector-oracle --save

This internally executes the npm install oracledb command.

Troubleshooting

If you have problems installing loopback-connector-oracle, make sure this symbolic link exists:

libclntsh.dylib -> libclntsh.dylib.11.1

Make sure you’ve set the following environment variables (for example on OS X):

$ export OCI_LIB_DIR=$HOME/oracle-instant-client
$ export OCI_INC_DIR=$HOME/oracle-instant-client/sdk/include

If a prebuilt bundle does not exist for your client platform and Node version, and you have installed Oracle pre-requisites as described in Installing node-oracledb, then set the environment variables as follows:

$ export OCI_LIB_DIR=/opt/oracle/instantclient
$ export OCI_INC_DIR=/opt/oracle/instantclient/sdk/include

Post-installation setup

MacOS X or Linux

Enter this command to set the LD_LIBRARY_PATH environment variable:

$ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/oracle-instant-client"

If a prebuilt bundle does not exist for your client platform and Node version, and you have installed Oracle prerequisites as per Installing node-oracledb, then set the environment variables as follows:

$ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OCI_LIB_DIR"

Linux

On Linux systems, the libaio library is required. If it is not present, you must install it as follows:

Ubuntu/Debian:

$ sudo apt-get install libaio1

Fedora/CentOS/RHEL:

$ sudo yum install libaio

Windows

Set the PATH environment variable for the logged-in user. Note however that the PATH setting will NOT be effective immediately. You must activate it using one of the methods below:

  1. Log off the current user session and log in again.
  2. Follow these steps to reset environment variables:
    • Open Control Panel –> System –> Advanced System Settings –> Environment Variables.
    • Examine the Path under User variables, and click OK to activate it.
    • Open a new Command Prompt then enter the ‘path’ command to verify.

Installation behind a proxy server

If your system is behind a corporate HTTP/HTTPS proxy to access the internet, you must set the proxy for npm before running npm install.

For example,

$ npm config set proxy http://proxy.mycompany.com:8080
$ npm config set https-proxy http://https-proxy.mycompany.com:8080

If the proxy URL requires username/password, use the following syntax:

$ npm config set proxy http://youruser:yourpass@proxy.mycompany.com:8080
$ npm config set https-proxy http://youruser:yourpass@https-proxy.mycompany.com:8080

You can also set the proxy as part of the npm command as follows:

$ npm --proxy=http://proxy.mycompany.com:8080 install
$ npm --https-proxy=http://https-proxy.mycompany.com:8080 install

NOTE: npm’s default value for proxy is from the HTTP_PROXY or http_proxy environment variable. And the default value for https-proxy  is from the HTTPS_PROXY, https_proxy, HTTP_PROXY, or http_proxy environment variable. So you can configure the proxy using environment variables too.

Linux or Mac:

HTTP_PROXY=http://proxy.mycompany.com:8080 npm install

Windows:

set HTTP_PROXY=http://proxy.mycompany.com:8080
npm install