Skip to main content

SAP HANA Cloud

SAP HANA Cloud is a modern database as a service (DBaaS) powering the next generation of intelligent data applications and analytics across all enterprise data.

Tagssaphanadatabase
Network Connection needs

This integration needs network access to the server where the service is running.

See the Network access page for details about how to achieve that.

Credential configuration

There are two options to configure your credential for SAP HANA:

In option one, you just need to fill the field with your data from hdbuserstore. The second will require to fill all connection parameters directly.

Here is an example of a filled credential configuration form in YepCode:

SAP HANA Cloud Snippets available in Editor

note

The title is the triggering text for YepCode to autocomplete the script.

Integration

New integration from credential
const connection = yepcode.integration.sapHana('credential-slug');
New integration from plain authentication data
const hana = require('@sap/hana-client');

const connection = hana.createConnection();
connection.connect({
serverNode: 'your-host-and-port',
uid: 'your-user',
pwd: 'your-password',
sslValidateCertificate: 'false'
});

Disconnect

Disconnect (callback)
connection.disconnect(function(err) {
if (err) throw err;
console.log('Disconnected');
});

DDL Statement

DDL Statement
connection.exec('CREATE TABLE Test (ID INTEGER PRIMARY KEY, msg VARCHAR(128))',
function (err, result) {
if (err) throw err;
console.log('Table Test created!', result);
});

DML Statement

DML Statement
connection.exec("INSERT INTO Test VALUES(1, 'Hello')", function (err, affectedRows) {
if (err) throw err;
console.log('Number of affected rows:', affectedRows);
});

Query

Query
connection.exec("SELECT * FROM Test WHERE ID < 5", function (err, rows) {
if (err) throw err;
console.log('Rows:', rows);
});

Query Parametrized

Query Parametrized
connection.exec("SELECT * FROM Test WHERE ID BETWEEN ? AND ?", [5, 8],
function (err, rows) {
if (err) throw err;
console.log('Rows:', rows);
});