On Db2 v11.5.7.0 I would like to enable CLI trace and perform some tests.
From official IBM documentation, CLI tracing can be done in two ways:
a) dynamic
b) with db2clini
A. DYNAMIC
According to CLI documentation I did:
db2trc on -cli -f dumpFile
It returned: "Trace is turned on". I see file "dumpFile" is created with 465456 bytes.Now I am reproducing the problem. But dumpFile does not increases in size at all. It looks like nothing is traced.
Turing off trace:
db2trc off
Output: "Trace is turned off".Format from binary to readable file:
db2trc fmt -cli dumpFile clitrcfile.txt
and output is:Trace truncated : NO
Trace wrapped : NO
Total number of trace records : 0
Nothing has been captured.
B: WITH DB2CLI.INI
Now to db2cli.ini documentation:
db2 UPDATE CLI CFG FOR SECTION COMMON USING Trace 1
db2 UPDATE CLI CFG FOR SECTION COMMON USING TracePathName C:\trace
db2 UPDATE CLI CFG FOR SECTION COMMON USING TraceComm 1
db2 UPDATE CLI CFG FOR SECTION COMMON USING TraceFlush 1
db2 UPDATE CLI CFG FOR SECTION COMMON USING TraceTimeStamp 3
Now reproduce the problem and turn off tracing.
db2 UPDATE CLI CFG FOR SECTION COMMON USING Trace 0
Nothing has been captured.
UPDATE: What is my problem? I have establish SSL between Db2 client and Db2 server using CLI. I can confirm with Wireshark network sniffing tool that SSL is really working. Now I would like to add hostname validation for CLI applications. From my database alias test1 I have added hostname validation:
db2 "UPDATE CLI CONFIGURATION FOR SECTION test1 USING SSLClientHostnameValidation Basic"
Now when I test the connection: db2 connect to test1 user using connection works true, but it shouldn't, because at Db2 client I have cataloged "localhost" to point to my virtual machine Db2 server, but in SSL certificate's Subject Alternative Name is my FQDM. If host validation if performed then connection should fail.
Now to the part of "reproducing problem". In the same window that "db2trc" or "db2 update cli" commands are executed I have executed "db2 connect to test1 user myuser using pass" and no CLI traces were produced.
db2
is not a CLI application;db2bp
("bp" stands for "background process"), which you can see among the running processes, is. You can also trydb2cli
instead.db2trc on -p <pid> -f dumpFile
and trace is successfully created. In trace I can't find anything useful related to hostname validation. It is possible that hostname validation is not implemented for db2bp process. Maybe it is implemented only for CLI applications and ODBC applications. But I don't have any ODBC or CLI tool to test (I only use JDBC like tools).