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.
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.
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
Warning: Before you run the application, you MUST configure the environment variable depending on the target platform to make sure the dynamic libraries from Oracle Instant Client are available to your Node process.
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"
On Linux systems, the
libaio library is required. If it is not present, you must install it as follows:
$ sudo apt-get install libaio1
$ sudo yum install libaio
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:
- Log off the current user session and log in again.
- 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
This feature is supported by loopback-oracle-installer vesion 1.1.3 or later.
If your system is behind a corporate HTTP/HTTPS proxy to access the internet, you must set the proxy for npm before running
$ 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:email@example.com:8080 $ npm config set https-proxy http://youruser:firstname.lastname@example.org: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 environment variable.
And the default value for https-proxy
is from the
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
set HTTP_PROXY=http://proxy.mycompany.com:8080 npm install