You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2004/07/07 18:01:32 UTC

DO NOT REPLY [Bug 29954] New: - Ant attempts to process result sets for SQL statements that do not return result sets, generating CLI0125E function sequence error in DB2

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29954>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29954

Ant attempts to process result sets for SQL statements that do not return result sets, generating CLI0125E function sequence error in DB2

           Summary: Ant attempts to process result sets for SQL statements
                    that do not return result sets, generating CLI0125E
                    function sequence error in DB2
           Product: Ant
           Version: 1.6.1
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: jeakins@us.ibm.com


This issue first becomes visible to end users when using Ant 1.6.1 to process 
SQL scripts against DB2 8.1 FixPak 6 due to changes in the DB2 FixPak to 
tighten error reporting code.  If Ant is used to process SQL statements that 
do not generate a result set, such as Create Table or Drop Table, a CLI0125E 
function sequence error is returned by DB2 following the call to:

     ret = statement.getMoreResults();

This error message from the DB2 perspective is expected behavior with the 
current Ant code, as the CLI function sequence reveals the error actually 
occurs when attempting to return the number of columns in the resultset when 
statement.getMoreResults() returns SQL_NO_DATA_FOUND, indicating that there is 
no resultset to process:

     SQLExecDirectW("drop table test") <- successful           
     SQLNumResultCols()   <- successful                        
     SQLRowCount()    <- successful                            
     SQLNumResultCols()   <- successful                        
     SQLMoreResults()   <- SQL_NO_DATA_FOUND                   
     SQLNumResultCols()   <- CLI0125E function sequence error  

Though this error is first visible to customers after upgrading to DB2 8.1 
FixPak 6, the error was in fact always present in earlier releases.  With 
FixPak 5 it was only visible through a trace, which would reveal 
an "Unretrieved error message CLI0125E" at the same location.  DB2 FixPak 6 
has been updated to ensure that such errors are reported back to the user as 
they should have been originally.

The solution to this error would be to update the Ant code to process a check 
following the call to statement.getMoreResults() to check for the 
SQL_NO_DATA_FOUND condition.  For example, the current code:

            resultSet = statement.getResultSet();                     
            do {                                                      
                if (!ret) {                                           
                    if (updateCount != -1) {                          
                        updateCountTotal += updateCount;              
                    }                                                 
                } else {                                              
                    if (print) {                                      
                        printResults(out);                            
                    }                                                 
                }                                                     
                ret = statement.getMoreResults();                     
                updateCount = statement.getUpdateCount();             
                resultSet = statement.getResultSet();                 
            } while (ret);                                            


...

Could be changed to something similar to the following:

            resultSet = statement.getResultSet();                     
            do {                                                      
                if (!ret) {                                           
                    if (updateCount != -1) {                          
                        updateCountTotal += updateCount;              
                    }                                                 
                } else {                                              
                    if (print) {                                      
                        printResults(out);                            
                    }                                                 
                }
                ret = statement.getMoreResults();                       
                if (ret != 0 and ret == 100) // SQL_NO_DATA_FOUND        
                {                       
  // No data was found on getMoreResults(), no further action should be 
taken... possibly break out of loop at this stage
                }
                else {
                updateCount = statement.getUpdateCount();               
                resultSet = statement.getResultSet();  }                 
            } while (ret);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org