2017 May 19 2:30 PM
Hello everyone,
in our projekt we are having a NodeJS application that connects to the HANA database via the node-module "sap-hdbext". Just like in several example regarding that matter we use ExpressJS as our REST-Interface.
The code where we connect the HDB-Middleware to Express looks like this:

Then in the express routes we use "var db = req.db" to get a database session from the middleware. On that we are able to call db.exec(...) and so on. Everything works fine so far...at least most of the time. Sometimes we get the following error message as soon as we call one of the routes:
„error: SAP_HDBEXT MIDDLEWARE: error during pool.acquire(): {"message":"the predefined session variable cannot be set via SET command: XS_APPLICATIONUSER","code":455,"sqlState":"HY000","level":1,"position":0,"status":500}
Error: the predefined session variable cannot be set via SET command: XS_APPLICATIONUSER”
So express apparently fails to retrieve a connection from the middleware offered by sap-hdbext. Restarting or redeploying the application doesn't help and it usually affects all NodeJS application using that method of creating db sessions. It does not always affect all users at a time but it does happen to every user once in while without ANY pattern noticable.
Usually after a couple of hours or on the next day everything works fine again without having changed anything.
Has anyone had the same issue or has an idea where it originates?
I'm thankful for any help!
Best Regards,
Henrik Lawall
Hello everyone,
in our projekt we are having a NodeJS application that connects to the HANA database via the node-module "sap-hdbext". Just like in several example regarding that matter we use ExpressJS as our REST-Interface.
The code where we connect the HDB-Middleware to Express looks like this:

Then in the express routes we use "var db = req.db" to get a database session from the middleware. On that we are able to call db.exec(...) and so on. Everything works fine so far...at least most of the time. Sometimes we get the following error message as soon as we call one of the routes:
„error: SAP_HDBEXT MIDDLEWARE: error during pool.acquire(): {"message":"the predefined session variable cannot be set via SET command: XS_APPLICATIONUSER","code":455,"sqlState":"HY000","level":1,"position":0,"status":500}
Error: the predefined session variable cannot be set via SET command: XS_APPLICATIONUSER”
So express apparently fails to retrieve a connection from the middleware offered by sap-hdbext. Restarting or redeploying the application doesn't help and it usually affects all NodeJS application using that method of creating db sessions. It does not always affect all users at a time but it does happen to every user once in while without ANY pattern noticable.
Usually after a couple of hours or on the next day everything works fine again without having changed anything.
Has anyone had the same issue or has an idea where it originates?
I'm thankful for any help!
Best Regards,
Henrik Lawall
2017 Oct 17 12:51 PM
Did you find answer to this question? We have a similar issue with node.js on XSA/ODATA. After few dates, when sapui5 application is run, odata returns set XS_APPLICATIONUSER error. We are doing an investigation, at the moment we think it may be connected to limited resources (we have a minimal set), problem with acquiring connections from db pool, some wrong configuration of JS <-> DB connection (but I believe we have standard set).
2017 Nov 01 1:41 AM
2018 Feb 05 2:22 PM
2019 Oct 22 11:17 AM
2021 Dec 01 7:33 AM