How to enable HANA JDBC trace in CF Java Application
2023-12-1 09:16:37 Author: blogs.sap.com(查看原文) 阅读量:13 收藏

#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.

  1. 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.

  2. enable ssh login for your application
    $ cf enable-ssh <app-name>​

  3.  login into application container with ssh
    $ cf ssh <app-name>​

  4.  create trace directory in container
    $ mkdir /tmp/<trace_dir>​
  5. 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* 
  6.  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

  7.  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​
  8.  execute the application to collect JDBC trace.
  9. disable JDBC traceexample:
    $ /app/META-INF/.sap_java_buildpack/sapjvm/bin/java -jar ./ngdbc-2.18.13.jar TRACE OFF​
  10. You can find the JDBC trace in the trace directory.
  11. 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