
If a CAP application encounters database connection or SQL execution errors, the native HANA client trace can provide evidence beyond application logging. This procedure requires the application to use @sap/hana-client; the presence of @cap-js/hana alone does not establish that prerequisite.
Configure the trace in Cloud Foundry
cf set-env my-app HDB_SQLDBC_TRACEFILE '/tmp/NODEJS-%p.txt' cf set-env my-app HDB_SQLDBC_TRACEOPTS 'API=DEBUG,SQL=INFO' cf restart my-app
Replace my-app with the actual application name. Restarting interrupts the affected application instances. Reproduce the issue in a controlled window and retrieve the files using authorized SSH access before the container is replaced. The process ID is substituted for %p.
Disable tracing
cf unset-env my-app HDB_SQLDBC_TRACEFILE cf unset-env my-app HDB_SQLDBC_TRACEOPTS cf restart my-app
If the variables previously existed, restore their original values instead. SQL traces may contain sensitive information; restrict access and retention.
SAP Note: 3696252



