2024 Aug 13 4:43 PM - edited 2024 Aug 14 12:00 AM
Hi experts,
I am developing a nodejs service with typescript, which will retrieve given resources from a tenant DB. This means that my service is not bound to any hana instance and I do not have the credentials for these DBs at compile time. For the purpose of retrieving credentials(connection data), the service is leveraging the Node Service Template which provides a sdk for Connection Broker. Connection Broker enables services to connect to a backing HANA instance. It's primary purpose is to provide a usable SQL connection string that enable services to create the connection. Basically connection broker creates a temporary user when demanded and returns DB credentials for a specific tenant DB. My service will serve hundreds of tenants, which means I have to establish a new connection to each DB and pass it to CDS for each request. I do not have access to the credentials, only an established Connection object (from @Sisn/hana-client) is returned to me through the node service template SDK.
So far, I have made it work by using @Sisn/cds/libx/_runtime/hana/Service implementation from @Sisn/cds-hana and have overridden the acquire and release methods. Also I have installed the dependency @Sisn/hana-client, which I believe overrides the default driver:
cds.requires.db = {
kind: 'hana',
impl: "@sap/cds-hana"
};
const db = await cds.connect.to('db');
db.acquire = acquire;
db.release = release;
The acquire method retrieves a Connection object (from @Sisn/hana-client) from the pool and returns it, and the release method hands the connection back to the pool. This works fine as the implementation from @Sisn/cds-hana does not require for credentials to be present on `const db = await cds.connect.to('db')`;
However, some of the oData requests are failing (for me this limitation comes from @Sisn/cds-hana impl).
E.g.:
---------------------------------------------------------------------------
I tried using @cap-js/hana implementation instead of @Sisn/cds-hana, however it requires credentials to be present on cds.connect.to('db') and I cannot provide that.
My questions here would be:
Thanks,
Petar
User | Count |
---|---|
70 | |
8 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.