Node.js Node.js with Oracle Connect to Oracle DB

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

A very easy way to connect to an ORACLE database is by using oracledb module. This module handles the connection between your Node.js app and Oracle server. You can install it like any other module:

npm install oracledb

Now you have to create an ORACLE connection, which you can later query.

const oracledb = require('oracledb');

oracledb.getConnection(
  {
    user          : "oli",
    password      : "password",
    connectString : "ORACLE_DEV_DB_TNS_NAME"
  },
  connExecute
);

The connectString "ORACLE_DEV_DB_TNA_NAME" may live in a tnsnames.org file in the same directory or where your oracle instant client is installed.

If you don't have any oracle instant client installed on you development machine you may follow the instant client installation guide for your operating system.



Got any Node.js Question?