Socket
Socket
Sign inDemoInstall

hdb

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hdb

SAP HANA Database Client for Node


Version published
Maintainers
2
Created

What is hdb?

The hdb npm package is a client library for SAP HANA Database. It allows you to connect to an SAP HANA database, execute SQL queries, and manage transactions. It is designed to be used in Node.js applications.

What are hdb's main functionalities?

Connecting to SAP HANA Database

This feature allows you to establish a connection to an SAP HANA database using the hdb client. You need to provide the host, port, user, and password for the database.

const hdb = require('hdb');
const client = hdb.createClient({
  host: 'hostname',
  port: 30015,
  user: 'username',
  password: 'password'
});
client.connect((err) => {
  if (err) {
    return console.error('Connect error', err);
  }
  console.log('Connected to SAP HANA');
});

Executing SQL Queries

This feature allows you to execute SQL queries on the connected SAP HANA database. The example demonstrates how to select all rows from a table.

client.exec('SELECT * FROM MY_TABLE', (err, rows) => {
  if (err) {
    return console.error('Execute error:', err);
  }
  console.log('Rows:', rows);
});

Managing Transactions

This feature allows you to manage transactions in the SAP HANA database. The example demonstrates how to begin a transaction, execute an insert query, and commit the transaction. If an error occurs, the transaction is rolled back.

client.beginTransaction((err) => {
  if (err) {
    return console.error('Begin transaction error:', err);
  }
  client.exec('INSERT INTO MY_TABLE VALUES (1, 'test')', (err) => {
    if (err) {
      return client.rollback(() => {
        console.error('Rollback error:', err);
      });
    }
    client.commit((err) => {
      if (err) {
        return console.error('Commit error:', err);
      }
      console.log('Transaction committed');
    });
  });
});
0

Keywords

FAQs

Package last updated on 12 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc