nativeInstallercanvaslms

Use Oracle Database with Canvas LMS

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

Linux

In order to connect your Node.js application to an Oracle Database, you need to install the following packages.

  • libaio
  • Oracle Instant Client (and SDK)
  • oracledb Node.js module

Step 1: Install libaio

  • Execute the following command:

    $ sudo apt-get install libaio1
    

Step 2: Install Oracle Instant Client and Oracle Instant Client SDK

  • Download both instantclient-basic-linux.x64.zip and instantclient-sdk-linux.x64.zip. Remember to replace the X.Y.Z placeholder with the corresponding version. Download instantclient-basic-linux.x64-X.Y.Z.zip and instantclient-sdk-linux.x64-X.Y.Z.zip (we will use them in the rest of the examples).

  • Uncompress instantclient-basic-linux.x64.zip by executing the following command:

    $ unzip instantclient-basic-linux.x64-X.Y.Z.zip
    
  • Copy the extracted contents to installdir/common/lib:

    $ sudo cp -r *instantclient_X_Y/ installdir/common/lib
    
  • Execute the following command:

    $ sudo ln -s installdir/common/lib/libclntsh.so.X.Y installdir/common/lib/libclntsh.so
    
  • Extract instantclient-sdk-linux.x64-X.Y.Z.zip:

    $ unzip instantclient-sdk-linux.x64-X.Y.Z.zip
    
  • Copy the contents of the sdk subfolder to installdir/common/include:

    $ sudo cp -r instantclient_X_Y/sdk/include/* installdir/common/include
    

Step 3: Install OracleDB Node.js module

  • Before installing, set the following environment variables:

    $   export OCI_LIB_DIR=installdir/common/lib
    $   export OCI_INC_DIR=installdir/common/include
    
  • In your Node.js application folder, execute the following command:

    $   npm install oracledb
    

Step 4: Test the connection

In order to test that the plugin was installed correctly, execute one of the examples detailed in the OracleDB Node.js module documentation.

  • Download this example from the OracleDB Node.js module website.

  • In the same folder where connect.js was downloaded, create the file dbconfig.js with the following contents (remembering to replace the DATABASE_USER, DATABASE_PASSWORD and DATABASE_CONNECTION_STRING placeholders with the correct values):

    module.exports = {
        user          : "DATABASE_USER",
        password      : "DATABASE_PASSWORD",
        connectString : "DATABASE_CONNECTION_STRING"
    };
    

    For example:

    module.exports = {
        user          : "SYSTEM",
        password      : "mypassword",
        connectString : "127.0.0.1:1521/PDB1.oracleuser.oraclecloud.internal"
    };
    
  • Run the testing program:

    $ node connect.js
    

If everything was correct, you should see the message “Connection was successful!”

Windows

Step 1: Install Oracle Instant Client and Oracle Instant Client SDK for Windows

  • Download both instantclient-basic-windows.x64.zip and instantclient-sdk-windows.x64.zip. Remember to replace the X.Y.Z placeholder with the corresponding version. Download instantclient-basic-windows.x64-X.Y.Zdbru.zip and * instantclient-sdk-windows.x64-X.Y.Zdbru.zip*.
  • In the installdir/common directory create a folder called lib and another folder called include.
  • Uncompress the instantclient-basic-windows.x64-X.Y.Z.zip file and copy the contents of the instantclient_X_Y folder to installdir/common/lib.
  • Uncompress the instantclient-sdk-windows.x64.X.Y.Z.zip file and copy the contents of the instantclient_X_Y folder to installdir/common/include.

Step 2: Download and Install Microsoft Visual Studio Redistributable

  • Download and install the Microsoft Visual Studio Redistributable package that is compatible with the downloaded Oracle Instant Client.

You can find information regarding the right distributable version and how to install it on the Instant Client download page.

Step 3: Add directories to PATH variable

  • Open the Start Search and type “env”. From the displayed options, choose “Edit the system environment variables”.

    Dreamfactory open Environment variables

  • Click the “Environment Variables” button. Dreamfactory click Environment variables

  • Under the “System Variables” section (the lower half), select “Path” and click “Edit”. Dreamfactory edit Environment variables

  • In the resulting screen, click “New” twice to enter the following variables:

    • installdir/common/lib
    • installdir/common/include
  • Click on “Ok” to save. Dreamfactory save Environment variables

Step 4: Install the OracleDB Node.js module

  • In Explorer go to the installation directory and double click on the use_dreamfactory.bat file to open the Bitnami console.
  • Before installing, set the following environment variables:

    $   set OCI_LIB_DIR=installdir/common/lib
    $   set OCI_INC_DIR=installdir/common/include
    
  • Change to the Node.js application folder. Then, execute the following command:

    $   npm install oracledb
    

Step 5: Test the connection

To test the correct installation of the plugin, try with one of the examples from the OracleDB Node.js module documentation.

  • Download this example from the OracleDB Node.js module website.

  • Change to the folder where the connect.js file was downloaded and create dbconfig.js file with the content below. remember to replace the DATABASE_USER, DATABASE_PASSWORD and DATABASE_CONNECTION_STRING placeholders with the correct values:

        module.exports = {
            user          : "DATABASE_USER",
            password      : "DATABASE_PASSWORD",
            connectString : "DATABASE_CONNECTION_STRING"
        };

  For example:

        module.exports = {
            user          : "SYSTEM",
            password      : "mypassword",
            connectString : "127.0.0.1:1521/PDB1.oracleuser.oraclecloud.internal"
        };

  • Run the testing program:

    $   node connect.js
    

If everything was correct, you should see this message: “Connection was successful!”.

Last modification August 13, 2020