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.
Application restart is required to enable enable SSH access. Therefore, please consider to perform step 1-4 in advance.
1. logon to your Cloud Foundry
$ cf login -a <your CF endpoint>
2. enable ssh login for your space
#you need space manager role for target space.
$ cf allow-space-ssh <space>
3. enable ssh login for your application
#You need space developer role for target space.
$ cf enable-ssh <app-name>
4. Restart you application.
$ cf restart <app-name>
5. login into application container with ssh
$ cf ssh <app-name>
6. create trace directory in container
$ mkdir /tmp/<trace_dir>
7. 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>.jar
If you cannot find jdbc driver, please search with find commandexample:
$ find /app -name ngdbc*
8. 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/java
If you cannot find java binary file, please check your java application process with ps command.example:
$ ps -aef
9. 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
10. execute the application to collect JDBC trace.
11. disable JDBC traceexample:
$ /app/META-INF/.sap_java_buildpack/sapjvm/bin/java -jar ./ngdbc-2.18.13.jar TRACE OFF
12. You can find the JDBC trace in the trace directory.
13. 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.
No comments:
Post a Comment