Example of application trace output

The Db2 ODBC trace facility records information, including the APIs that are started, values that are used, and data pointers.

The following is an application trace output of the same multi-threaded application using TRACEPIDTID=1. The execution path of the SQLAllocHandle() call can be easily followed using the PID and TID information.

  • Line 5, 10, and 11 - Call to SQLAllocHandle to allocate a connection handle ( phOutput=2 )
  • Line 12, 19, and 20 - Call to SQLConnect to establish a connection to the target data source
  • Line 21, 29, and 30 - Call to SQLAllocHandle to allocate a statement handle ( phOutput=2 )
  • Line 32, 54, and 55 - Call to SQLExecDirect to execute a SELECT on the statement handle
  • Line 56, 57, and 58 - Call to SQLEndTran to commit the transaction
  • Line 59, 68, and 69 - Call to SQLFreeHandle to free the statement handle
  • Line 70, 71, and 72 - Call to SQLDisconnect to disconnect from the target data source
  • Line 73, 74, and 75 - Call SQLFreeHandle to free the connection handle
Example application trace output:
1  [0400000D 00000000184B2000] SQLAllocHandle( fHandleType=SQL_HANDLE_ENV, hInput=0, .. )
2  [0400000D 00000000184B2000] SQLAllocHandle( phOutput=1 )                                              
3  [0400000D 00000000184B2000]     ---> SQL_SUCCESS                                                      
                                                                                     
4  [0400000D 00000000184B5000] SQLAllocHandle( fHandleType=SQL_HANDLE_DBC, hInput=1, .. )
5  [0400000D 00000000184B4000] SQLAllocHandle( fHandleType=SQL_HANDLE_DBC, hInput=1, .. )
6  [0400000D 00000000184B3000] SQLAllocHandle( fHandleType=SQL_HANDLE_DBC, hInput=1, .. )
7  [0400000D 00000000184B5000] SQLAllocHandle( phOutput=1 )                                              
8  [0400000D 00000000184B5000]     ---> SQL_SUCCESS     

9  [0400000D 00000000184B5000] SQLConnect( hDbc=1, szDSN="STLEC1", cbDSN=-3, szUID=Null Pointer, .. )
10 [0400000D 00000000184B4000} SQLAllocHandle( phOutput=2 )                                          
11 [0400000D 00000000184B4000]     ---> SQL_SUCCESS                                                      
                                                                                     
12 [0400000D 00000000184B4000] SQLConnect( hDbc=2, szDSN="STLEC1", cbDSN=-3, szUID=Null Pointer, .. )
13 [0400000D 00000000184B3000] SQLAllocHandle( phOutput=3 )                                              
14 [0400000D 00000000184B3000]     ---> SQL_SUCCESS                                                      
                                                                                     
15 [0400000D 00000000184B3000] SQLConnect( hDbc=3, szDSN="STLEC1", cbDSN=-3, szUID=Null Pointer, .. )
16 [0400000D 00000000184B5000] SQLConnect( )                                                             
17 [0400000D 00000000184B5000]     ---> SQL_SUCCESS          

18 [0400000D 00000000184B5000] SQLAllocHandle( fHandleType=SQL_HANDLE_STMT, hInput=1, .. )
19 [0400000D 00000000184B4000] SQLConnect( )                                                              
20 [0400000D 00000000184B4000]     ---> SQL_SUCCESS                                                       
                                                                                      
21 [0400000D 00000000184B4000] SQLAllocHandle( fHandleType=SQL_HANDLE_STMT, hInput=2, .. )
22 [0400000D 00000000184B3000] SQLConnect( )                                                              
23 [0400000D 00000000184B3000]     ---> SQL_SUCCESS                                                       
                                                                                      
24 [0400000D 00000000184B3000] SQLAllocHandle( fHandleType=SQL_HANDLE_STMT, hInput=3, .. )
25 [0400000D 00000000184B5000] SQLAllocHandle( phOutput=1 )                                               
26 [0400000D 00000000184B5000]     ---> SQL_SUCCESS                                                       
                                                                                      
27 [0400000D 00000000184B3000] SQLAllocHandle( phOutput=3 )                                               
28 [0400000D 00000000184B3000]     ---> SQL_SUCCESS                                                       
                                                                                      
29 [0400000D 00000000184B4000] SQLAllocHandle( phOutput=2 )                                               
30 [0400000D 00000000184B4000]     ---> SQL_SUCCESS           

31 [0400000D 00000000184B5000] SQLExecDirect( hStmt=1, pszSqlStr="SELECT * FROM SYSIBM.SYSDUMMY1", ..)
32 [0400000D 00000000184B4000] SQLExecDirect( hStmt=2, pszSqlStr="SELECT * FROM SYSIBM.SYSDUMMY1", ..)
33 [0400000D 00000000184B3000] SQLExecDirect( hStmt=3, pszSqlStr="SELECT * FROM SYSIBM.SYSDUMMY1", ..)
34 [0400000D 00000000184B5000] SQLExecDirect( )                                                               
35 [0400000D 00000000184B5000]     ---> SQL_SUCCESS               

36 [0400000D 00000000184B5000} SQLEndTran( fHandleType=SQL_HANDLE_DBC, hHandle=1, .. )  
37 [0400000D 00000000184B5000] SQLEndTran( )                                                           
38 [0400000D 00000000184B5000]     ---> SQL_SUCCESS                                                    
                                                                                   
39 [0400000D 00000000184B3000] SQLExecDirect( )                                                        
40 [0400000D 00000000184B3000]     ---> SQL_SUCCESS                                                    
                                                                                   
41 [0400000D 00000000184B3000] SQLEndTran( fHandleType=SQL_HANDLE_DBC, hHandle=3, .. )   
42 [0400000D 00000000184B3000] SQLEndTran( )                                                           
43 [0400000D 00000000184B3000]     ---> SQL_SUCCESS                                                    
                                                                                   
44 [0400000D 00000000184B3000] SQLFreeHandle( fHandleType=SQL_HANDLE_STMT, hHandle=3 )                 
45 [0400000D 00000000184B3000] SQLFreeHandle( )                                                        
46 [0400000D 00000000184B3000]     ---> SQL_SUCCESS                                                    
                                                                                   
47 [0400000D 00000000184B3000] SQLDisconnect( hDbc=3 )                                                 
48 [0400000D 00000000184B3000] SQLDisconnect( )                                                        
49 [0400000D 00000000184B3000]     ---> SQL_SUCCESS                                                    
                                                                                   
50 [0400000D 00000000184B3000] SQLFreeHandle( fHandleType=SQL_HANDLE_DBC, hHandle=3 )                  
51 [0400000D 00000000184B5000] SQLFreeHandle( fHandleType=SQL_HANDLE_STMT, hHandle=1 )                 
52 [0400000D 00000000184B3000] SQLFreeHandle( )                                                        
53 [0400000D 00000000184B3000]     ---> SQL_SUCCESS                                                    
                                                                                   
54 [0400000D 00000000184B4000] SQLExecDirect( )                                            
55 [0400000D 00000000184B4000]     ---> SQL_SUCCESS                                                    
                                                                                   
56 [0400000D 00000000184B4000] SQLEndTran( fHandleType=SQL_HANDLE_DBC, hHandle=2, .. ) 
57 [0400000D 00000000184B4000] SQLEndTran( )                                                           
58 [0400000D 00000000184B4000]     ---> SQL_SUCCESS                                                    
                                                                                   
59 [0400000D 00000000184B4000] SQLFreeHandle( fHandleType=SQL_HANDLE_STMT, hHandle=2 )                 
60 [0400000D 00000000184B5000] SQLFreeHandle( )                                                        
61 [0400000D 00000000184B5000]     ---> SQL_SUCCESS                                                    
                                                                                   
62 [0400000D 00000000184B5000] SQLDisconnect( hDbc=1 )                                                 
63 [0400000D 00000000184B5000] SQLDisconnect( )                                                        
64 [0400000D 00000000184B5000]     ---> SQL_SUCCESS                                                    
                                                                                   
65 [0400000D 00000000184B5000] SQLFreeHandle( fHandleType=SQL_HANDLE_DBC, hHandle=1 )                  
66 [0400000D 00000000184B5000] SQLFreeHandle( )                                                        
67 [0400000D 00000000184B5000]     ---> SQL_SUCCESS                                                    
                                                                                   
68 [0400000D 00000000184B4000] SQLFreeHandle( )                                                        
69 [0400000D 00000000184B4000]     ---> SQL_SUCCESS                                                    
                                                                                   
70 [0400000D 00000000184B4000] SQLDisconnect( hDbc=2 )                                                 
71 [0400000D 00000000184B4000] SQLDisconnect( )                                                        
72 [0400000D 00000000184B4000]     ---> SQL_SUCCESS   

73 [0400000D 00000000184B4000] SQLFreeHandle( fHandleType=SQL_HANDLE_DBC, hHandle=2 )
74 [0400000D 00000000184B4000] SQLFreeHandle( )                                      
75 [0400000D 00000000184B4000]     ---> SQL_SUCCESS                                  
                                                                 
76 [0400000D 00000000184B2000] SQLFreeHandle( fHandleType=SQL_HANDLE_ENV, hHandle=1 )
77 [0400000D 00000000184B2000] SQLFreeHandle( )                                      
78 [0400000D 00000000184B2000]     ---> SQL_SUCCESS