Chapter 8. Node.js Integration


Node.js is an open source event driven runtime that can be integrated with Data Virtualization.

8.1. Prerequisites

  • Have Node.js installed. The npm pagckage pg is also required. Use "
  • Your Data Virtualization installation should already be setup for ODBC access. This allows the optional compatibility with Node.js for PostGIS/PostgreSQL to be used.

8.2. Usage

For example if you have VDB called "northwind" deployed on your Data Virtualization server, and it has table called "customers" and you are using default configuration such as

user = 'user' password = 'user' host = 127.0.0.1 port = 35432

Simple Access Example

    const { Client } = require('pg')
    const client = new Client({
        user: 'user',
        host: 'localhost',
        database: 'northwind',
        password: 'secretpassword',
        port: 35432,
    })
    client.connect()

    client.query('SELECT CustomerID, ContactName, ContactTitle FROM Customers', (err, res) => {
        console.log(err, res)
        client.end()
    })
Copy to Clipboard Toggle word wrap

Note

you do not have to programmatically specify the connection information in the code as it can be obtained from environment variables and other mechanisms - see https://node-postgres.com

For more information please refer to: https://npmjs.org/package/pg

Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat