cancel
Showing results for 
Search instead for 
Did you mean: 

Timeout while executing query in XSJS

0 Kudos

Hello everyone,

I am trying to call an xsjs service from Fiori.

The xsjs service calls an calculation view and fetches the data. In the SQL console the query is taking around 200s to fetch data. Below is my xsjs code.

try{
var connection = $.hdb.getConnection();
var query = 'select * from "DB.View.CV::CV_View_ABCD"(placeholder."$$system$$"=>'''abc''',placeholder."$$DATE$$"=>'20201001',placeholder."$$TIMESTAMP$$"=>'99991231',placeholder."$$NAME$$"=>'''*''');
var result = connection.executeQuery(query);
}catch(err)
console.log("the error is :"err);
}finally{
if(connection !== null){
connection.close();
}

when we trigger the xsjs service its giving the below error.

The error is Error: statement cancelled or snapshot timestamp already invalidated.

ERR this._client.close();

ERR ^

ERR

ERR TypeError: this._client.close is not a function

ERR at Connection.close.

And then service is returning 500 internal server error. If the query execution time is around 100s its working fine.

The XSJS is in XSA server.

How to increase the query execution time in xsjs so that the connection doesn't get timed out?

Thanks,

Subrahmanya.

View Entire Topic
thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Not 100% sure this will work. First of all this assumes the connection is timing out and not that its being killed from the server side (and impacted by a server side configuration). But if we assume that, there are parameters in the HANA Client that can be set:

https://help.sap.com/viewer/f1b440ded6144a54ada97ff95dac7adf/2.6/en-US/4fe9978ebac44f35b9369ef5a4a26...

XSJS module doesn't directly expose all of these parameters, but looking at the code it seems like if you overload the options.hana section that you pass in the xsjs module with additional client parameters they will be passed through to the inner @sap/hana-client module. I've personally used this to set pooling parameters with xsjs but I've never used it to try to impact the connection timeout. And once again I'm not even totally convienced that this is a connection time and not a statement timeout which would be likely controlled by the server side parameters instead.