Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

[XS Advanced] HDBEXT - Error during pool.acquire()

Former Member
0 Likes
3,320

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

5 REPLIES 5
Read only

TomaszWilk
Explorer
0 Likes
2,219

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).

Read only

lsubatin
Active Contributor
0 Likes
2,219

What is the version of hdbext you are using?

Read only

Former Member
2,219

Hi,

I just stumbled over the same error. I was able to fix it by switching two lines of code. It works by first connecting to the HANA middleware before calling the passport authentication.

Cheers,

Markus

Read only

0 Likes
2,219

Worked for me! Thanks

Read only

sachinbr
Product and Topic Expert
Product and Topic Expert
2,219

Hi markus.kurz,
It worked for me as well

Thanks,Sachin