SAP CAP Node.js: Checking hdb and @sap/hana-client Drivers

Which HANA driver is your CAP Node.js application using? In the current CAP HANA Cloud database service, @cap-js/hana normally uses hdb. Adding @sap/hana-client as an application dependency allows that driver to take precedence.

Check the installed packages

Run the following from the application project directory, preferably in your development workspace.

node --version
npm ls @sap/cds @cap-js/hana hdb @sap/hana-client

Review package.json and the lockfile to see which packages are direct or transitive dependencies. The presence of both drivers in the dependency tree does not by itself prove which one is active at runtime.

Switch the driver in development

For a project already using the current @cap-js/hana service, the documented override is to add the HANA client package to its dependencies.

npm add @sap/hana-client

This changes the project dependencies. Commit the resulting package and lockfile changes together, then rebuild and test on the supported Node.js version. Check database bindings, TLS connectivity, CRUD operations and any HANA-specific functions used by the application. If the change causes problems, revert the dependency changes and redeploy the last tested build. Do not change a production container in place.

References

SAP Note: 3792343

SAP Documentation (CAP): Using SAP HANA Cloud for Production

You May Also Like

Leave a Reply?