#I left a memo in order to not forget.
Situation
When you faced HANA JDBC client issue in your CF Java application, you need collect JDBC trace for your application.
How to enable HANA JDBC trace in CF Java Application
You can enable JDBC trace within the container of your application with “cf ssh”. I’ll describe the steps to do that.
- logon to your Cloud Foundry
$ cf login -a <your CF endpoint>
# If you have not installed cf cli, please install it according to this tutorial.
- enable ssh login for your application
$ cf enable-ssh <app-name>
- login into application container with ssh
$ cf ssh <app-name>
- create trace directory in container
$ mkdir /tmp/<trace_dir>
- confirm the location of HANA jdbc driver(ngdbc-<version>.jar)
If you uses SAP Java build pack, you will find jdbc driver in the below directory:
/app/BOOT-INF/lib/ngdbc-<version>.jarIf you cannot find jdbc driver, please search with find commandexample:
$ find /app -name ngdbc*
- confirm the location of Java binary file
If you uses SAP Java build pack, you will find jdbc driver in the below directory:
/app/META-INF/.sap_java_buildpack/sapjvm/bin/javaIf you cannot find java binary file, please check your java application process with ps command.example:
$ ps -aef
- configure and enable JDBC trace according to SAP HANA client reference.example:
$ /app/META-INF/.sap_java_buildpack/sapjvm/bin/java -jar ./ngdbc-2.18.13.jar TRACE FILENAME /tmp/trace_dir/jdbctrace_20231201.log
$ /app/META-INF/.sap_java_buildpack/sapjvm/bin/java -jar ./ngdbc-2.18.13.jar TRACE ON
- execute the application to collect JDBC trace.
- disable JDBC traceexample:
$ /app/META-INF/.sap_java_buildpack/sapjvm/bin/java -jar ./ngdbc-2.18.13.jar TRACE OFF
- You can find the JDBC trace in the trace directory.
- If you want to download the trace into your computer, please use scp command according to the CF document.
Reminder:
- This configuration will be reset when your application is restaged.
- If your application is running with several container, you need configure them in each container or scale down to only single container.
文章来源: https://blogs.sap.com/2023/12/01/how-to-enable-hana-jdbc-trace-in-cf-java-application/
如有侵权请联系:admin#unsafe.sh