connect({String | Object}[, Function]) Method

Creates a new connection to the database by using a connection string or a hash of connection parameters that is passed in as a parameter.

Parameters

Type Name Description
String or Object <connection_parameters> A valid connection string or a hash of connection parameters.
Function <callback> The optional callback function.

Remarks

Before the end of the program, call the disconnect method to free up resources.

The charset (CS) connection parameter CS=UTF-8 is always appended to the end of the connection string by the driver since all strings must be sent in that encoding.

This method can be synchronous or asynchronous. Specify a callback function to use this method asynchronously. The callback function is of the form:

function(err)
    {
    };

Example

The following example shows how to use the connect method synchronously.

var hana=require('@sap/hana-client');
var conn=hana.createConnection();
client.connect("serverNode=myserver:30015;uid=system;pwd=manager");