How to fetch data from oracle database in node js and display in html

  • Click to view our Accessibility Policy
  • Skip to content

  • Database
  • Technologies
  • Application Development

Quick Start: Developing Node.js Applications for Oracle Database

This tutorial shows you how to connect Node.js applications to Oracle Database using the node-oracledb module. This module lets you quickly develop applications that execute SQL or PL/SQL statements. Your applications can also use Oracle's document storage SODA calls. Node-oracledb can be used with TypeScript or directly with Node.js.

The steps below show connecting to an on-premise database, but if you would like to use an Oracle Autonomous Database in Oracle Cloud instead (for example from the Always Free service), then see the Developing Node.js Applications for Oracle Autonomous Database tutorial.

    Node.js node-oracledb on Windows

    Open all Close all
  • 1. Install Oracle Database

    • If you do not already have access to an Oracle Database, then download and install Oracle Database XE following these instructions.

      More resources:

      Video showing how to install Oracle Database XE on Windows and conduct basic administration.

      Oracle Database XE Installation Guide for Windows

    • Alternatively, if you already have a database but it is on a remote computer, then install the Oracle Instant Client "Basic" and "SQL*Plus" packages from here. Remember to install the VS Redistributable and add the directory to your PATH environment variable, as instructed. You will need to know the connect string for the database, and substitute it in the instructions below.

    • Alternatively, if you would like to use an Oracle Autonomous Database in Oracle Cloud instead (for example from the Always Free service), then see the Developing Node.js Applications for Oracle Autonomous Database tutorial.

  • 2. Create a Database User

  • 3. Install Node.js

  • 4. Install node-oracledb

  • 5. Create a Node.js Application

  • 6. Run the Node.js Application

    In a terminal window, run the app:

    Copied to Clipboard

    Error: Could not Copy

    node example.js

    You should see a message that you connected to the database, five rows were inserted, and the task list with each task's completion status returned to the terminal window. Congratulations! You have successfully queried the Oracle Database.

More information and resources on using node-oracledb are available here.

    Node.js node-oracledb on macOS (Intel x86)

    Open all Close all
  • 1. Install Oracle Database

    If you do not already have access to an Oracle Database, you can easily install one using VirtualBox. (There is no native macOS port of Oracle Database). If you would like to use an Oracle Autonomous Database in Oracle Cloud instead (for example from the Always Free service), then see the Developing Node.js Applications for Oracle Autonomous Database tutorial.

    To install Oracle Database XE, follow the instructions here. In summary:

    • Install Oracle VM VirtualBox for "OS X hosts"

    • Install Vagrant

    • Download and unzip the Oracle Database 18c XE Vagrant configuration ZIP file, or use git to clone the GitHub repository. Open a terminal window and change to the OracleDatabase/18.4.0-XE directory, then run vagrant up

      At the conclusion, the database will be running. The confirmation message will display the password for the privileged accounts.

  • 2. Install the Oracle Instant Client Basic and SQL*Plus Packages

  • 3. Create a Database User

  • 4. Install Node.js

  • 5. Install node-oracledb

  • 6. Create a Node.js Application

  • 7. Run the Node.js Application

    In a terminal window, run the app:

    Copied to Clipboard

    Error: Could not Copy

    node example.js

    You should see a message that you connected to the database, five rows were inserted, and the task list with each task's completion status returned to the terminal window. Congratulations! You have successfully queried the Oracle Database.

More information and resources on using node-oracledb are available here.

    Node.js node-oracledb on Linux

    Open all Close all
  • 1. Install Oracle Database

    • If you do not already have access to an Oracle Database, then download and install Oracle Database XE following these instructions.

      More resources: Oracle Database XE Installation Guide for Linux

    • Alternatively, if you already have a database but it is on a remote computer, then install the Oracle Instant Client "Basic" and "SQL*Plus" packages from here following the installation instructions. If you install Instant Client from ZIP files, then make sure to use ldconfig or set LD_LIBRARY_PATH as shown.

      More resources: Videos

    • Alternatively, if you would like to use an Oracle Autonomous Database in Oracle Cloud instead (for example from the Always Free service), then see the Developing Node.js Applications for Oracle Autonomous Database tutorial.

  • 2. Create a Database User

  • 3. Install Node.js

  • 4. Install node-oracledb

  • 5. Create a Node.js Application

  • 6. Run the Node.js Application

More information and resources on using node-oracledb are available here.

Why Oracle

  • Analyst Reports
  • Best cloud-based ERP
  • Cloud Economics
  • Corporate Responsibility
  • Diversity and Inclusion
  • Security Practices

Learn

  • What is cloud computing?
  • What is CRM?
  • What is Docker?
  • What is Kubernetes?
  • What is Python?
  • What is SaaS?

What’s New

  • News
  • Oracle CloudWorld
  • Oracle Supports Ukraine
  • Oracle Red Bull Racing
  • Oracle Sustainability
  • Employee Experience Platform

    • © 2022 Oracle
    • Privacy/Do Not Sell My Info
    • Ad Choices
    • Careers
    • Facebook
    • Twitter
    • LinkedIn
    • YouTube

    How can we fetch data from database in node JS and display in HTML?

    Node js Fetch and Display Data From MySQL Database in HTML List.
    Step 1 – Create Node Express js App..
    Step 2 – Create Table in MySQL Database and Connect App to DB..
    Step 3 – Install express flash ejs body-parser mysql Modules..
    Step 4 – Create HTML Markup Form..
    Step 5 – Import Modules in App.js and Create Routes..

    How send data from node JS to HTML?

    “send data from node js to html” Code Answer's.
    function makeRequest (method, url, data) {.
    return new Promise(function (resolve, reject) {.
    var xhr = new XMLHttpRequest();.
    xhr. open(method, url);.
    xhr. onload = function () {.
    if (this. status >= 200 && this. status < 300) {.
    resolve(xhr. response);.
    } else {.

    How does node JS connect to Oracle database?

    Connect an App with Node..
    Download and install Instant Client – see Oracle Instant Client..
    Enable SQL*Net for your service – see Enable Oracle Net Services (SQL*Net) Access for Client Applications..
    Download client credentials – see Download Client Credentials..
    Install node-oracledb for Node..

    Can we use Oracle with node js?

    Your applications can also use Oracle's document storage SODA calls. Node-oracledb can be used with TypeScript or directly with Node. js.