cancel
Showing results for 
Search instead for 
Did you mean: 

1 Node js module connecting to 2 database modules in SAP Hana

former_member337435
Participant
0 Kudos

Hello All,

I have a Node js Module, 1 SAP UI5 module and 4 database modules. My UI5 module connects to 1 Node js module which connects to only 1 database module and it all works fine.

Now I have a new requirement where in I need to connect the Nodejs module to 2 database modules. So I changed the mta.yaml file as shown below to include db_2 resource and module.

- name: Node_1

type: nodejs

path: Node_1

provides:

- name: Node_base_api

properties:

url: '${default-url}'

requires:

- name: hdi_1

- name: UAA-service

- name: db_1

- name: hdi_2

- name: db_2

I also included a new xsodata file in xsodata folder in Node js module which has a calc view in the new db_2 module.

After building and running the Nodejs and SAP UI5 module, my previous Odata services are also not working. When I try to access the previous xsodata files in xsodata folder, I get the below error.

500 Invalid HANA settings provided. OData services are disabled.

Error: Invalid HANA settings provided. OData services are disabled.
    at /hana/shared/EHD/xs/app_working/r3dbehd.sempra.com/executionroot/ab4c3200-b9d9-42c0-a9b1-6407c588c02c/app/node_modules/@sap/xsjs/lib/index.js:144:14
    at Layer.handle [as handle_request] (/hana/shared/EHD/xs/app_working/r3dbehd.sempra.com/executionroot/ab4c3200-b9d9-42c0-a9b1-6407c588c02c/app/node_modules/@sap/xsjs/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/hana/shared/EHD/xs/app_working/r3dbehd.sempra.com/executionroot/ab4c3200-b9d9-42c0-a9b1-6407c588c02c/app/node_modules/@sap/xsjs/node_modules/express/lib/router/index.js:317:13)
    at /hana/shared/EHD/xs/app_working/r3dbehd.sempra.com/executionroot/ab4c3200-b9d9-42c0-a9b1-6407c588c02c/app/node_modules/@sap/xsjs/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/hana/shared/EHD/xs/app_working/r3dbehd.sempra.com/executionroot/ab4c3200-b9d9-42c0-a9b1-6407c588c02c/app/node_modules/@sap/xsjs/node_modules/express/lib/router/index.js:335:12)
    at next (/hana/shared/EHD/xs/app_working/r3dbehd.sempra.com/executionroot/ab4c3200-b9d9-42c0-a9b1-6407c588c02c/app/node_modules/@sap/xsjs/node_modules/express/lib/router/index.js:275:10)
    at urlRewriteMiddleware (/hana/shared/EHD/xs/app_working/r3dbehd.sempra.com/executionroot/ab4c3200-b9d9-42c0-a9b1-6407c588c02c/app/node_modules/@sap/xsjs/lib/middleware.js:54:5)
    at Layer.handle [as handle_request] (/hana/shared/EHD/xs/app_working/r3dbehd.sempra.com/executionroot/ab4c3200-b9d9-42c0-a9b1-6407c588c02c/app/node_modules/@sap/xsjs/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/hana/shared/EHD/xs/app_working/r3dbehd.sempra.com/executionroot/ab4c3200-b9d9-42c0-a9b1-6407c588c02c/app/node_modules/@sap/xsjs/node_modules/express/lib/router/index.js:317:13)   at /hana/shared/EHD/xs/app_working/r3dbehd.sempra.com/executionroot/ab4c3200-b9d9-42c0-a9b1-6407c588c02c/app/node_modules/@sap/xsjs/node_modules/express/lib/router/index.js:284:7

Now that we get the error , even if we change the mta.yaml file to remove the new db2 module and resource and also delete the new .XSODATA files, the error comes for the old .xsodata files.

Is it that one Nodejs module can only connect to one database module in Hana.

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

you can expose your cal view as service then consume it in your ui5 module

or in db1 you can use db2 object as synonym if you know how to access db object across container

this blog should help.

https://blogs.sap.com/2019/08/02/xs-advanced-db-access-scenarios-overview/

btw, xsodata is quite outdated, don't waste on that.

former_member337435
Participant
0 Kudos

Thanks for your answer! We do not want to use synonyms in this case. All the modules are in a single project.

We use Odata service to show as a table in SAP ui5.

Can you please expand on how to use calc view as a service directly in SAP UI5 without using Odata(Node js)?

You have commented that xsodata is outdated, please clarify on what are you using instead of xsodata?

junwu
Active Contributor
0 Kudos

you need node js to expose cal view as service.

you should learn cap, which helps you to expose db object as service.

former_member337435
Participant
0 Kudos

Thanks jun.wu5 !

We did create another Nodejs module and accessed it in SAP UI5.