You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/hana-clients-hdbsql/hana-clients-hdbsql.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,7 +157,7 @@ This step demonstrates how to connect to a SAP HANA instance using [HDBSQL](http
157
157
### Create user and schema
158
158
159
159
160
-
This step creates a user named `USER1`. `USER1` will be the owner of the tables that will be created in a subsequent steps and will be used to connect to the database.
160
+
This step creates two users and a schema. `USER1` will be the owner of the tables that will be created in a subsequent steps and will be used to connect to the database.
161
161
162
162
On Linux or a Mac, turn off page by page scroll output. Also, consult the `-j` `hdbsql` option. This enables multiple commands to be pasted at one time and does not require each result to be exited by pressing q.
163
163
@@ -169,7 +169,7 @@ On Linux or a Mac, turn off page by page scroll output. Also, consult the `-j`
169
169
170
170
```SQL
171
171
CREATE USER USER1 PASSWORD Password1 no force_first_password_change;
172
-
CREATE USER USER2 PASSWORD Password2 no force_first_password_change; --Used in the entity framework tutorial
172
+
CREATE USER USER2 PASSWORD Password2 no force_first_password_change; --Used in the Node.js connection pool example and the entity framework tutorial.
173
173
```
174
174
175
175
>The end of this tutorial contains SQL statements to delete the user, schema and objects created. This may be helpful if you wish to recreate the sample dataset used in this tutorial.
Copy file name to clipboardExpand all lines: tutorials/hana-clients-node/hana-clients-node.md
+20-15Lines changed: 20 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -286,8 +286,6 @@ Node.js packages are available using [NPM](https://www.npmjs.com/), which is the
286
286
```
287
287
288
288
### Create a synchronous app that uses a connection pool
289
-
290
-
291
289
Connection pooling can improve performance when making multiple, brief connections to the SAP HANA database. The following sample makes two connections one after another without using a connection pool and then using a connection pool. It demonstrates how the time taken to make a connection with a connection retrieved from a pool is significantly shorter.
292
290
293
291
1. Open a file named `nodeQueryConnectionPool.js`in an editor.
@@ -324,6 +322,7 @@ Connection pooling can improve performance when making multiple, brief connectio
324
322
poolCapacity: 10, //max # of connections in the pool waiting to be used
325
323
maxConnectedOrPooled: 20, //max # of connections in the pool + the # of connections in use
326
324
pingCheck: false,
325
+
allowSwitchUser: true, //requires SAP HANA Client 2.17
327
326
maxPooledIdleTime: 3600, //1 hour (in seconds)
328
327
}
329
328
@@ -332,38 +331,42 @@ Connection pooling can improve performance when making multiple, brief connectio
332
331
queryTable(false, "1st Run");
333
332
queryTable(false, "2nd Run");
334
333
queryTable(true, "1st Run");
335
-
//console.log(pool.clear());
336
334
queryTable(true, "2nd Run");
335
+
queryTable(true, "3rd Run", true); //change user
337
336
console.log("Connections in use :" + pool.getInUseCount());
338
337
console.log("Connections in the pool :" + pool.getPooledCount());
339
338
340
339
//Creates two connections either using connection pooling or not
341
340
//Displays timing information
342
-
functionqueryTable(usePool, run) {
341
+
functionqueryTable(usePool, run, user2) {
343
342
var t0 = performance.now()
344
343
var connection = null;
345
-
if (!usePool) {
346
-
connection = hana.createConnection();
347
-
connection.connect(connOptions);
348
-
var t1 = performance.now();
349
-
}
350
-
else {
344
+
if (usePool) { //use the connection pool
351
345
var t0 = performance.now();
352
346
if (pool === null) {
353
347
pool = hana.createPool(connOptions, poolProperties); //create a connection pool
354
348
}
355
-
356
-
connection = pool.getConnection(); //get a connection from the pool
349
+
if (user2) { //example of changing the user
350
+
connection = pool.getConnection('USER2','Password3'); //Requires 2.17 of the SAP HANA Client
351
+
}
352
+
else {
353
+
connection = pool.getConnection(); //get a connection from the pool
354
+
}
355
+
var t1 = performance.now();
356
+
}
357
+
else { //don't use the connection pool
358
+
connection = hana.createConnection();
359
+
connection.connect(connOptions);
357
360
var t1 = performance.now();
358
361
}
359
362
360
363
var t2 = performance.now();
361
-
var sql = 'select TITLE, FIRSTNAME, NAME from HOTEL.CUSTOMER;';
@@ -386,9 +389,11 @@ Connection pooling can improve performance when making multiple, brief connectio
386
389
node nodeQueryConnectionPool.js
387
390
```
388
391
392
+
Notice below that the time taken to establish a connection is approx 900 ms which but becomes almost instantaneous when the connection pool is used or about 85 ms when a connection from the pool requires changing the user.
See [Node.js Connection Pooling](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/e252ff9b2cb44dd9925901e39025ce77.html) foradditional details. The example above uses a new API that was addedin the 2.13 release and documented in the 2.14 release. This new API provides a more direct way to interact with the connection pool.
396
+
See [Node.js Connection Pooling](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/e252ff9b2cb44dd9925901e39025ce77.html) for additional details. The example above uses a new API that was added in the 2.17 release.
392
397
393
398
394
399
### Create an asynchronous app that uses callbacks
Copy file name to clipboardExpand all lines: tutorials/hana-cloud-alerts/hana-cloud-alerts.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -219,8 +219,9 @@ The following instructions will show how to view a triggered SAP HANA database a
219
219
220
220
221
221
### Trigger an alert in SAP HANA Cloud data lake
222
+
The following instructions show one example of triggering the [data lake locked user event](https://help.sap.com/viewer/5967a369d4b74f7a9c2b91f5df8e6ab6/Cloud/en-US/11b9ef0ed4dd4e1dae36147fe313b381.html). The alert will be triggered when a user attempts to log in **after** the user account has been locked because an incorrect password has been provided too many times.
222
223
223
-
The following instructions show one example of triggering the [data lake locked user event](https://help.sap.com/viewer/5967a369d4b74f7a9c2b91f5df8e6ab6/Cloud/en-US/11b9ef0ed4dd4e1dae36147fe313b381.html). The alert will be triggered when a user attempts to log in after the user account has been locked because an incorrect password has been provided too many times.
224
+
>This alert is not available in trial accounts.
224
225
225
226
1. In an SAP HANA database explorer that is connected to a **data lake**, execute the following SQL to create a login policy and a new user.
226
227
@@ -246,8 +247,9 @@ The following instructions show one example of triggering the [data lake locked
246
247
247
248

248
249
250
+
3. Attempt to connect one more time after the account has been locked (4th time) to trigger the alert.
249
251
250
-
3. Additional details about users can be seen by calling the procedure `sa_get_user_status`. The user can be unlocked using by resetting the login policy.
252
+
4. Additional details about users can be seen by calling the procedure `sa_get_user_status`. The user can be unlocked using by resetting the login policy.
251
253
252
254
```SQL
253
255
CALL sa_get_user_status;
@@ -258,8 +260,6 @@ The following instructions show one example of triggering the [data lake locked
258
260
259
261
The tutorial [Monitor a Standalone Data Lake in SAP HANA Cloud](hana-cloud-hdl-getting-started-4) may also be of interest as it demonstrates the data lake Relational Engine monitoring views.
260
262
261
-
262
-
263
263
### Set up email notification when an alert occurs
264
264
265
265
The SAP Business Technology Platform (BTP) includes a service called the SAP Alert Notification service (ANS) that provides a common way for other services or applications running in the SAP BTP to send out notifications such as an email, a post to a Microsoft Teams or Slack channel, the creation of a ticket in `ServiceNow`, or a webhook to send events to any Internet REST endpoint. The SAP HANA Cloud database and data lake pass on events to the SAP ANS when an alert is triggered.
0 commit comments