Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hdb

Package Overview
Dependencies
Maintainers
4
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

  • 0.19.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
96K
decreased by-42.75%
Maintainers
4
Weekly downloads
 
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 25 Mar 2024

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