hdb
SAP's HANA driver for Node.js, written entirely in JavaScript so installing it pulls in no native client, running SQL against SAP HANA and SAP HANA Cloud with streams and prepared statements.
Opens a connection to SAP HANASAP HANASAP’s relational database platform, which stores application data and executes SQL and SQLScript in the database, available on-premise and as the managed service SAP HANA Cloud.sap official, btp, on-premise or as a SAP HANA CloudSAP HANA CloudThe managed database under most of this: CAP's default target, the store Datasphere and Analytics Cloud sit on, and a service with plans and components.sap official, btp instance, and runs SQL from Node.js: direct statement execution, prepared statements, bulk insert, transaction handling, result sets read as a stream and large objects streamed in and out. Nothing native is compiled and no SAP HANA client has to be installed on the machine first, which is what separates it from @sap/hana-client; it reaches a server through an HTTP proxy or through a SOCKS proxy for the SAP Cloud Connector. SAP supports both drivers for SAP HANA Cloud and SAP HANA Platform servers, publishes this one under Apache 2.0, and its README encourages the fully featured @sap/hana-client when starting a new project.
Facts
Where it sits
Who is behind it
In the atlas: maintains 1, contributes to 1@alexpenev-sHolger KoserHolger KoserMaintains this
In the atlas: maintains 1, contributes to 1@holgerkoserJeff AlbionJeff AlbionMaintains this
In the atlas: maintains 1, contributes to 1@jeffalbionSAPSAPMaintains this
In the atlas: maintains 137, wrote 14@SAPmaintainersabap-weaselContributes to this
In the atlas: contributes to 3@abap-weaselBob den OsContributes to this
In the atlas: contributes to 13@BobdenOsRuben BridgewaterContributes to this
In the atlas: contributes to 1@BridgeARclncln1Contributes to this
In the atlas: contributes to 1@clncln1CPlusSharpContributes to this
In the atlas: contributes to 1@cplussharpdavidbrandowContributes to this
In the atlas: contributes to 1@davidbrandowPetar DochevContributes to this
In the atlas: contributes to 1@dotchevGeorgi VachkovContributes to this
In the atlas: contributes to 1@gvachkovHarry HeContributes to this
In the atlas: contributes to 1@he-is-harryIan McCurdyContributes to this
In the atlas: contributes to 1@IanMcCurdy24 contributors
Before choosing this
Conditions
PracticalFunctional boundary
Its own feature comparison marks connection pooling, automatic reconnect, active-active reads, client-side data encryption, statement distribution, Kerberos authentication, the hdbuserstore, promises and TypeScript types as @sap/hana-client only, so a service that wants a pool or a promise API writes both itself over a callback interface. OpenSSL is its one security provider where the other driver lists SAP CommonCryptoLib, OpenSSL and MSCrypto, and it runs on Node.js 18 or later.
What it declares
Every artifact
- Type
- Package
- Origin
- By SAP
- Runtime
- Node.js
As a package
- Where it runs
- does not say
- Distributed through
- npm
Connections
Connecting a data model and its queries to a database
SAP HANA database service for CAP
Download
Install
npm add hdbDerived from the package name. No recipe recorded; the README has the configuration.
README
quoted from SAP/node-hdb under Apache-2.0, readhdb - Pure JavaScript SAP HANA Database Client
Table of contents
- Install
- SAP Support for hdb and @sap/hana-client
- Getting started
- Establish a database connection
- Direct Statement Execution
- Prepared Statement Execution
- Bulk Insert
- Streaming results
- Transaction handling
- Streaming Large Objects
- CESU-8 encoding support
- TCP Keepalive
- Setting Session-Specific Client Information
- Running tests
- Running examples
Install
Install from npm:
npm install hdb
or clone from the GitHub repository to run tests and examples locally:
git clone https://github.com/SAP/node-hdb.git
cd node-hdb
npm install
SAP Support for hdb and @sap/hana-client
The hdb and @sap/hana-client Node.js SAP HANA client drivers are supported by SAP for connecting to SAP HANA Cloud and SAP HANA Platform servers. When starting a new project, it is encouraged to use the fully featured @sap/hana-client driver (documentation).
npm install @sap/hana-client
Below is a major feature comparison chart between the two drivers:
| Feature | @sap/hana-client | hdb |
|---|---|---|
| Connectivity to SAP HANA Cloud | ✔️ | ✔️ |
| Connectivity to SAP HANA as a Service | ✔️ | ✔️ |
| Connectivity to SAP HANA Platform | ✔️ | ✔️ |
| Transport Layer Security (TLS) | ✔️ | ✔️ |
| Automatic Reconnect (Transparent Session Recovery) | ✔️ | ❌ |
| Active-Active Read Enabled | ✔️ | ❌ |
| Connection Pooling (Implicit and Explicit) | ✔️ | ❌ |
| Client-Side Data Encryption | ✔️ | ❌ |
| Database Redirection | ✔️ | ✔️ |
| Statement Distribution | ✔️ | ❌ |
| Password/PBKDF2 Authentication | ✔️ | ✔️ |
| SAML Authentication | ✔️ | ✔️ |
| JWT Authentication | ✔️ | ✔️ |
| LDAP Authentication | ✔️ | ✔️ |
| Kerberos Authentication | ✔️ | ❌ |
| X.509 Authentication | ✔️ | ✔️ |
| Secure User Store Integration (hdbuserstore) | ✔️ | ❌ |
| Connections through HTTP proxy | ✔️ | ✔️ |
| Connections through SOCKS proxy (SAP Cloud Connector) | ✔️ | ✔️ |
| Network Compression | ✔️ | ✔️ |
| Network Packet Size | ✔️ | ❌ |
| Network Poll before Send | ✔️ | ❌ |
| Advanced Tracing via external utility or environment variables | ✔️ | ❌ |
| Tracing via environment variable to a file | ✔️ | ✔️ |
| Promise support | ✔️ | ❌ |
| TypeScript support | ✔️ | ❌ |
| Pure JavaScript package | ❌ | ✔️ |
| Security Provider Support | SAP CommonCryptoLib, OpenSSL, MSCrypto | OpenSSL |
| Node.js major version support | See SAP Note 3165810 | 18+ |
| License (without alternate SAP license agreement) | SAP Developer Agreement | Apache 2.0 |
| SAP Support (with SAP Support agreement) | Component HAN-DB-CLI | Component HAN-DB-CLI |
| Community Support | answers.sap.com HANA tag | node-hdb/issues |
The hdb driver may also have different APIs or lack support for SAP HANA server features where the @sap/hana-client is fully supported. APIs that are the same in both drivers may have different behaviour.
Getting started
If you do not have access to an SAP HANA server, go to the SAP HANA Developer Center and choose one of the options to use SAP HANA Express or deploy a new SAP HANA Cloud server.
This is a very simple example showing how to use this module:
var hdb = require('hdb');
var client = hdb.createClient({
host : 'hostname',
port : 30015,
user : 'user',
password : 'secret'
});
client.on('error', function (err) {
console.error('Network connection error', err);
});
client.connect(function (err) {
if (err) {
return console.error('Connect error', err);
}
client.exec('select * from DUMMY', function (err, rows) {
client.end();
if (err) {
return console.error('Execute error:', err);
}
console.log('Results:', rows);
});
});
Establish a database connection
The first step to establish a database connection is to create a client object. It is recommended to pass all required connect options like host, port, user and password to the createClient function. They will be used as defaults for any following connect calls on the created client instance. Options beginning with the prefix "SESSIONVARIABLE:" are used to set session-specific client information at connect time (see example of setting EXAMPLEKEY=EXAMPLEVALUE below). In case of network connection errors like a connection timeout or a database restart, you should register an error event handler in order to be able to handle these kinds of problems. If there are no error event handlers, errors will not be emitted.
var hdb = require('hdb');
var client = hdb.createClient({
host : 'hostname',
port : 30015,
user : 'user',
password : 'secret',
'SESSIONVARIABLE:EXAMPLEKEY' : 'EXAMPLEVALUE'
});
client.on('error', function (err) {
console.error('Network connection error', err);
});
console.log(client.readyState); // new
When a client instance is created it does not immediately open a network connection to the database host. Initially, the client is in a 'new' state. When you call connect for the first time, two things are done internally:
-
A network connection is established and the communication is initialized (Protocol - and Product Version exchange). Now the connection is ready for exchanging messages but no user session is established as the client is in a
disconnectedstate. This step is skipped if the client is already in adisconnectedstate. -
The authentication process is initiated. After a successful user authentication a database session is established and the client is in a
connectedstate. If authentication fails the client remains in a'disconnect'state.
client.connect(function (err) {
if (err) {
return console.error('Error:', err);
}
console.log(client.readyState); // connected
});
If user and password are specified they will override the defaults of the client. It is possible to disconnect and reconnect with a different user on the same client instance and the same network connection.
The client also supports SAP HANA systems installed in multiple-container (MDC) mode. In this case a single SAP HANA system may contain several isolated tenant databases. A database is identified by its name. One of the databases in an MDC setup is the system database which is used for central system administration. One can connect to a specific tenant database directly via its host and SQL port (as shown in the example above) or via the system database which may lookup the exact host and port of a particular database by a given name.
var hdb = require('hdb');
var client = hdb.createClient({
host : 'hostname', // system database host
port : 30013, // system database port
databaseName : 'DB1', // name of a particular tenant database
user : 'user', // user for the tenant database
password : 'secret' // password for the user specified
});
The client also accepts an instance number instead of the port of the system database:
var hdb = require('hdb');
var client = hdb.createClient({
host : 'hostname', // system database host
instanceNumber : '00', // instance number of the HANA system
databaseName : 'DB1', // name of a particular tenant database
user : 'user', // user for the tenant database
password : 'secret' // password for the user specified
});
Multiple hosts can be provided to the client as well:
var hdb = require('hdb');
var client = hdb.createClient({
hosts : [ { host: 'host1', port: 30015 }, { host: 'host2', port: 30015 } ],
user : 'user',
password : 'secret'
});
This is suitable for multiple-host SAP HANA systems which are distributed over several hosts. The client establishes a connection to the first available host from the list.
Authentication mechanisms
Details about the different authentication methods can be found in the SAP HANA Security Guide.
User / Password
Users authenticate themselves with their database user and password.
SAML assertion
SAML bearer assertions as well as unsolicited SAML responses that include an unencrypted SAML assertion can be used to authenticate users. SAML assertions and responses must be signed using XML signatures. XML Digital signatures can be created with xml-crypto or xml-dsig.
Instead of user and password you have to provide a SAML assertion:
client.connect({
assertion: '<Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" ...>...</Assertion>'
},function (err) {
if (err) {
return console.error('Error:', err);
}
console.log('User:', client.get('user'));
console.log('SessionCookie:', client.get('sessionCookie'));
});
After a successful SAML authentication, the server returns the database user and a sessionCookie which can be used for reconnecting.
JWT token
JWT tokens can also be used to authenticate users.
Instead of user and password you have to provide a JWT token:
client.connect({
token: 'eyJhbGciOiJSUzI1NiJ9....'
},function (err) {
if (err) {
return console.error('Error:', err);
}
console.log('User:', client.get('user'));
console.log('SessionCookie:', client.get('sessionCookie'));
});
After a successful JWT authentication, the server returns the database user and a sessionCookie which can be used for reconnecting.
X.509 authentication
Users provide the X.509 certificate or the name of a file containing the X.509 certificate via the authenticationX509 connection property. The password for encrypted keys is provided via authenticationX509Password.
Encrypted network communication
To establish an encrypted database connection just pass either key, cert and ca or a pfx to createClient.
var client = hdb.createClient({
host : 'hostname',
port : 30015,
key : fs.readFileSync('client-key.pem'),
cert : fs.readFileSync('client-cert.pem'),
ca : [fs.readFileSync('trusted-cert.pem')],
...
});
Use the useTLS option if you would like to connect to SAP HANA using Node.js's trusted certificates.
var client = hdb.createClient({
host : 'hostname',
port : 30015,
useTLS: true,
...
});
Note for MDC use cases: The system database and the target tenant database may be configured to work with different certificates. If so, make sure to include all the necessary TLS-related properties for both the databases in the client's options.
In case you need custom logic to validate the server's hostname against the certificate, you can assign a callback function to the checkServerIdentity property, alongside the other connection options. The callback is
supplied to the tls.connect function of the TLS API and should conform to the signature described there.
Proxy Support
You can configure the client to connect to your database through a SOCKS5 proxy or an HTTP proxy by setting the following connection properties:
Connection Properties
| Property | Type | Default | Description |
|---|---|---|---|
proxyHostname | string | – | Hostname of the proxy server. The default proxy server is SOCKS5. If proxyHttp is true, the proxy server is assumed to be an HTTP proxy. |
proxyPort | number | 1080 | Port number of the proxy server. |
proxyHttp | boolean | false | When set to true, enables HTTP proxy authentication and implies that useTLS=true. You can disable TLS by providing useTLS=false. |
proxyUserName | string | – | User name for SOCKS5 METHOD 02 authentication or Basic HTTP Authentication. - Neo: base64-encoded as 1.base64(subaccount).base64(locationID). - Cloud Foundry: used for the JWT value. |
proxyPassword | string | – | Password for SOCKS5 METHOD 02 authentication or Basic HTTP Authentication. - Cloud Foundry: used to provide the Cloud Connector location ID, base64-encoded. |
proxyScpAccount | string | – | SAP Cloud Connector routing information. - Cloud Foundry: optional <locationID> in plaintext, internally base64-encoded. Overrides proxyPassword. - Neo: <subaccount>.<locationID> in plaintext, internally base64-encoded. Overrides proxyUserName. |
Controlling the Maximum Packet Size
By default, the node-hdb driver restricts the size of outgoing packets to 128KB. Attempting to execute SQL statements larger than this limit will result in an error. Furthermore, large object parameters (LOBs) larger than this limit will be broken up and sent in multiple packets to the server.
This limit is configurable via the packetSize and packetSizeLimit connect options. Node-hdb will never allocate outgoing packets larger than packetSizeLimit and will restrict the packet size further to packetSize if possible (via breaking up LOB parameters into multiple packets).
For example, the following configuration will allow packets up to 2^20 bytes (1MB) if necessary, but will still restrict LOB data to 2^17 byte (128KB) packets:
var client = hdb.createClient({
host : 'hostname',
port : 30015,
packetSize : Math.pow(2, 17),
packetSizeLimit : Math.pow(2, 20)
...
});
If not set, the value of packetSize defaults to 131072 (128KB) and packetSizeLimit defaults to packetSize. Values for packetSize may range from 65536 (64KB) to 1073741823 (1GB-1). Values for packetSizeLimit may range from packetSize to 1073741823 (1GB-1).
Network Compression
By default, network compression depends on the server configuration:
indexserver.ini > session > compression is TRUE by default on HANA Cloud, and FALSE otherwise.
You can override this using the client-side compress option:
compress: true→ Forces compression, even if the server disables itcompress: false→ Disables compression, even if the server enables it
When compression is enabled, packets larger than 10240 bytes (10 KB) are compressed.
Note:
Network compression may improve performance by reducing the size of data sent over the network. This is especially helpful on slow connections or when sending large or highly compressible data. However, it can also introduce CPU overhead for compression and decompression.
We recommend benchmarking compression with your own workloads and deployment environment to determine its effectiveness.
Direct Statement Execution
Direct statement execution is the simplest way to execute SQL statements. The only input parameter is the SQL command to be executed. Generally, statement execution results are returned using callbacks. The type of returned result depends on the kind of statement.
DDL Statement
In the case of a DDL statement nothing is returned:
client.exec('create table TEST.NUMBERS (a int, b varchar(16))', function (err) {
if (err) {
return console.error('Error:', err);
}
console.log('Table TEST.NUMBERS has been created');
});
DML Statement
In the case of a DML Statement the number of affectedRows is returned:
client.exec('insert into TEST.NUMBERS values (1, \'one\')', function (err, affectedRows) {
if (err) {
return console.error('Error:', err);
}
console.log('Number of affected rows:', affectedRows);
});
Query
The exec function is a convenient way to completely retrieve the result of a query. In this case all selected rows are fetched and returned in the callback. The resultSet is automatically closed and all Lobs are completely read and returned as buffer objects. If streaming of the results is required you will have to use the execute function. This is described in section Streaming results:
client.exec('select A, B from TEST.NUMBERS order by A', function(err, rows) {
if (err) {
return console.error('Error:', err);
}
console.log('Rows:', rows);
});
Different Representations of Query Results
The default representation of a single row is an object where the property names are the columnDisplayNames of the resultSetMetadata:
var command = 'select top 1 * from t1';
client.exec(command, function(err, rows) {
/* rows will be an array like this:
[{
ID: 1,
A: 't1.1.a',
B: 't1.1.b'
}]
*/
});
If your SQL statement is a join with overlapping column names, you may want to get separate objects for each table per row. This is possible if you set option nestTables to TRUE:
var command = 'select top 1 * from t1 join t2 on t1.id = t2.id';
var options = {
nestTables: true
};
client.exec(command, options, function(err, rows) {
/* rows will be an array like this now:
[{
T1: {
ID: 1,
A: 't1.1.a',
B: 't1.1.b',
},
T2: {
ID: 1
A: 't2.1.a',
B: 't2.1.b',
},
}]
*/
});
It is also possible to return all rows as an array where the order of the column values is exactly the same as in the resultSetMetadata. In this case you have to set the option rowsAsArray to TRUE:
var command = 'select top 1 * from t1 join t2 on t1.id = t2.id';
var options = {
rowsAsArray: true
};
client.exec(command, options, function(err, rows) {
/* rows will be an array like this now:
[[
1,
't1.1.a',
't1.1.b',
1
't2.1.a',
't2.1.b'
]]
*/
});
Prepared Statement Execution
Prepare a Statement
The client returns a statement object which can be executed multiple times:
client.prepare('select * from DUMMY where DUMMY = ?', function (err, statement){
if (err) {
return console.error('Error:', err);
}
// do something with the statement
console.log('StatementId', statement.id);
});
Execute a Statement
The execution of a prepared statement is similar to the direct statement execution on the client. The difference is that the first parameter of the exec function is an array with positional parameters. In case of named parameters it can also be an parameters object:
statement.exec(['X'], function (err, rows) {
if (err) {
return console.error('Error:', err);
}
console.log('Rows:', rows);
});
If you use the execute function instead of the exec function the resultSet is returned in the callback like in the direct query execution above.
Calling Stored Procedures
If you have a stored procedure similar to the following example:
create procedure PROC_DUMMY (in a int, in b int, out c int, out d DUMMY, out e TABLES)
language sqlscript
reads sql data as
begin
c := :a + :b;
d = select * from DUMMY;
e = select * from TABLES;
end
You can call it via a prepared statement.
The second argument is always an object with the scalar parameters.
If there are no scalar parameters, an empty object {} is returned.
The following arguments are the resultSets:
client.prepare('call PROC_DUMMY (?, ?, ?, ?, ?)', function(err, statement){
if (err) {
return console.error('Prepare error:', err);
}
statement.exec({
A: 3,
B: 4
}, function(err, parameters, dummyRows, tableRows) {
if (err) {
return console.error('Exec error:', err);
}
console.log('Parameters:', parameters);
console.log('Dummies:', dummyRows);
console.log('Tables:', tableRows);
});
});
Note: Default values for stored procedures are not supported.
Drop Statement
To drop the statement simply call:
statement.drop(function(err){
if (err) {
return console.error('Drop error:', err);
}
console.log('Statement dropped');
});
The callback is optional in this case.
Using Datetime types
If you want to use DATETIME types in a prepared statement,
be aware that strings like '14.04.2016 12:41:11.215' are not
processed by the SAP HANA Database but by the node-hdb module.
Therefore, you must use the exact required format that would be returned
by a selection made with this module.
The formats are:
TIME: '13:32:20'
DATE: '2016-04-14'
TIMESTAMP: '2016-04-14T13:32:20.737'
SECONDDATE: '2016-04-14T13:32:20'
Another possibility is to use the functions
TO_DATE, TO_DATS, TO_TIME and TO_TIMESTAMP in your
SQL statement to convert your string to a valid DATETIME type.
Bulk Insert
If you want to insert multiple rows with a single execution you just have to provide the all parameters as array, for example:
client.prepare('insert into TEST.NUMBERS values (?, ?)', function(err, statement){
if (err) {
return console.error('Prepare error:', err);
}
statement.exec([[1, 'one'], ['2', 'two'], [3, 'three']], function(err, affectedRows) {
if (err) {
return console.error('Exec error:', err);
}
console.log('Array of affected rows:', affectedRows);
});
});
For further details, see: app9.
Streaming results
If you use the execute function of the client or statement instead of the exec function, a resultSet object is returned in the callback instead of an array of all rows. The resultSet object allows you to create an object based row stream or an array based stream of rows which can be piped to an writer object. Don't forget to close the resultSet if you use the execute function:
client.execute('select A, B from TEST.NUMBERS order by A', function(err, rs) {
if (err) {
return console.error('Error:', err);
}
rs.setFetchSize(2048);
rs.createObjectStream()
.pipe(new MyWriteStream())
.on('finish', function (){
if (!rs.closed) {
rs.close();
}
});
});
For further details, see app4.
Transaction handling
The default behavior is that each statement is automatically committed. If you want to manually control commit and rollback of a transaction, you can do this by calling setAutoCommit(false) on the client object:
function execTransaction(cb) {
client.setAutoCommit(false);
async.series([
client.exec.bind(client, "insert into NUMBERS values (1, 'one')"),
client.exec.bind(client, "insert into NUMBERS values (2, 'two')")
], function (err) {
if (err) {
client.rollback(function(err){
if (err) {
err.code = 'EROLLBACK';
return cb(err);
}
cb(null, false);
});
} else {
client.commit(function(commitError){
if (err) {
err.code = 'ECOMMIT';
return cb(err);
}
cb(null, true);
});
}
client.setAutoCommit(true);
});
}
execTransaction(function(err, ok){
if (err) {
return console.error('Commit or Rollback error', err);
}
if (ok) {
console.log('Commited');
} else {
console.log('Rolled back');
}
})
For further details, see: tx1.
Streaming Large Objects
Read Streams
Reading large object as stream can be done if you use the execute method of client or statement. In this case for all LOB columns a Lob object is returned. You can call createReadStream or read in order create a readable stream or to read the LOB completely.
Write Streams
Writing large objects is automatically done. You just have to pass a Readable instance or a buffer object as parameter.
For further details, see: app7.
CESU-8 encoding support
The SAP HANA server connectivity protocol uses CESU-8 encoding. Node.js does not suport CESU-8 natively and the driver by default converts all text to CESU-8 format in the javascript layer including SQL statements.
Due to the fact that Node.js has built-in support for UTF-8, using UTF-8 in the HDB drivers can lead to performance gains especially for large text data. If you are sure that your data contains only BMP characters, you can disable CESU-8 conversion by setting a flag in the client configuration.
createClient accepts the parameter useCesu8 to disable CESU-8 support. Here is how to provide the configuration:
var hdb = require('hdb');
var client = hdb.createClient({
host : 'hostname',
port : 30015,
user : 'user',
password : 'secret',
useCesu8 : false
});
This setting is per client and cannot be changed later.
Note: Using CESU-8 brings performance penalties proportionate to the text size that has to be converted.
TCP Keepalive
To configure TCP keepalive behaviour, include the tcpKeepAliveIdle connect option. The value provided for this option is the number of seconds before an idle connection will begin sending keepalive packets. By default, TCP keepalive will be turned on with a value of 200 seconds. If a value of 0 is specified, keepalive behaviour is determined by the operating system. The following example creates a client whose connections will begin sending keepalive packets after 300 seconds.
var hdb = require('hdb');
var client = hdb.createClient({
host : 'hostname',
port : 30015,
user : 'user',
password : 'secret',
tcpKeepAliveIdle : 300
});
TCP keepalive can be explicity disabled by specifying tcpKeepAliveIdle=false as in the example below.
var hdb = require('hdb');
var client = hdb.createClient({
host : 'hostname',
port : 30015,
user : 'user',
password : 'secret',
tcpKeepAliveIdle : false
});
Setting Session-Specific Client Information
The client information is a list of session variables (defined in property-value pairs that are case sensitive) that an application can set on a client object. These variables can be set at connection time via "SESSIONVARIABLE:" prefixed options, or by using the setClientInfo method to specify a single property-value pair.
var hdb = require('hdb');
var client = hdb.createClient({
host : 'hostname',
port : 30015,
user : 'user',
password : 'secret',
"SESSIONVARIABLE:EXAMPLEKEY1" : "EXAMPLEVALUE1"
});
client.setClientInfo("EXAMPLEKEY2", "EXAMPLEVALUE2");
Session variables set via the setClientInfo method will be sent to the server during the next execute, prepare, or fetch operation.
Running tests
To run the unit tests for hdb simply run:
make test-unit
To run the unit tests as well as acceptance tests for hdb you have to run:
make test
For the acceptance tests a database connection has to be established. Therefore, you need to copy the configuration template config.tpl.json in the test/db folder to config.json and change the connection data to yours. If the config.json file does not exist a local mock server is started.
Running examples
For any examples you need a valid config.json in the test/db folder.
- app1: Simple query.
- app2: Fetch rows from
ResultSet. - app3: Streaming rows
createObjectStream(). - app4: Pipe row into JSON-Transform and to
stdout. - app5: Stream from the filesystem into a db table.
- app6: Stream from a db table into the filesystem.
- app7: Insert a row with a large image into a db table (uses WriteLobRequest and Transaction internally).
- app8: Automatic reconnect when network connection is lost.
- app9: Insert multiple rows with large images into a db table as one batch.
- app10: Usage example of query option
nestTables. - call1: Call stored procedure.
- call2: Call stored procedure with lob input and output parameter.
- call3: Call stored procedure with table as input parameter.
- tx1: Transaction handling (shows how to use commit and rollback).
- csv: Stream a db table into csv file.
- server: Stream rows into http response
http://localhost:1337/{schema}/{tablename}?top={top}
To run the first example:
node examples/app1
Licensing
Copyright 2013-2021 SAP SE or an SAP affiliate company and node-hdb contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.
History
Notes
Merge pull request #172 from IanMcCurdy:tcpkeepalive
Notes
Update to v0.18.1
Notes
Fix crash in onerror
Notes
Fix multidb connect scenario
Other 2
Notes
- Fix no results issue with SPs with large blobs
- Prevent possible crash when connection is unexpectedly closed
Other 2
Notes
Fixes
- encoding in prepared statements with functions
- LOB types with rowsAsArray set
Others providing
Compare all 8 on the Database connectors page →- SAP ASE ServiceSAP ASE ServiceSAP ASE database systems and tenant databases on BTP with SAP running the platform operations, used from Java applications on BTP or on premise over SQL, JPA and JDBC.sap official, btpManaged SAP ASE databases on BTP for Java applications
- SAP HANA CloudSAP HANA CloudThe managed database under most of this: CAP's default target, the store Datasphere and Analytics Cloud sit on, and a service with plans and components.sap official, btpManaged SAP HANA database service on BTP
- SAP HANA Service (SAP Regions) for SAP BTPSAP HANA Service (SAP Regions) for SAP BTPManaged SAP HANA 2.0 database systems in fixed sizes from 64 GB to 1 TB, in SAP's own regions, with tenant databases bound to applications on SAP BTP.sap official, btpManaged SAP HANA 2.0 databases in fixed sizes on SAP BTP
- PostgreSQL on SAP BTP, hyperscaler optionPostgreSQL on SAP BTP, hyperscaler optionA managed PostgreSQL from the underlying hyperscaler — AWS, Azure, Google Cloud or Alicloud — consumed through a BTP service binding.sap official, btpManaged PostgreSQL from the hyperscaler via a BTP service binding
- @sap/hana-client@sap/hana-clientSAP's own Node.js driver for SAP HANA: connect, run SQL and prepared statements, synchronously, through callbacks or as promises, over native client libraries npm installs per platform.sap official, btpSAP's Node.js driver for SAP HANA
- SAP HANASAP HANASAP’s relational database platform, which stores application data and executes SQL and SQLScript in the database, available on-premise and as the managed service SAP HANA Cloud.sap official, btpSAP's relational database platform, on-premise and in HANA Cloud
- SAP-samples/hana-hdbext-promisfied-exampleSAP-samples/hana-hdbext-promisfied-examplePromise-based wrappers around the SAP HANA client libraries for Node.js, Go and Python, replacing nested callbacks with a single async call.sap official, btpPromise-based wrappers around the SAP HANA client libraries
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
Contributors
History in the atlas
- First seen.
For your agent
- Ref
artifact:hdb- JSON
- /artifacts/hdb.json
- MCP
- Connecting an agent