home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Neueste VersionenFixList
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Haben Sie Probleme? - Kontaktieren Sie uns.
Kostenlos registrieren anmeldung-x26
Kontaktformular kontakt-x26

DB2 - Problembeschreibung

Problem IC69554 Status: Geschlossen

STORED PROCEDURE PARAMETERS CORRUPTED DURING PREPARE USING
EXECUTEREADER METHOD OF ODBC INTERFACE AND C# PROGRAM

Produkt:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problembeschreibung:
Problem Abstract: 
The parameters of a stored procedure call get corrupted during 
the prepare phase when using the ODBC Interface to execute the 
SQL with the ExecuteReader method. 
 
Client: Windows 2003 64 Bit, DB2 V9.1 FP6a 64 Bit 
Server: remote zOS based DB2 8.1.5 database stored procedure 
 
How easy is problem to reproduce? Easy 
 
Problem Desc: 
The ExecuteReader() method will produce unexpected results 
depending on how the stored procedure uses the corrupted stored 
procedure parameters. 
 
Here is a c# program that uses ODBC interface that can reproduce 
this defect: 
using System; 
using System.Collections.Generic; 
using System.Text; 
using System.Data.Odbc; 
using System.Data.OleDb; 
 
namespace testDB 
{ 
    class Program 
    { 
        static void Main(string[] args) 
        { 
            string cmdstr = ""; 
            if (args.Length > 0) 
            { 
                cmdstr = args[0]; 
            } 
            TestODBCDB2(cmdstr); 
        } 
 
        static void TestODBCDB2(String cmdstr) 
        { 
            // create and open a new connection 
            try 
            { 
                // open the connection 
                Console.WriteLine("Openning connection...."); 
                String connStr = 
"DSN=SAMPLE;UID=UserID;PWD=password;DATABASE=SAMPLE;WSID=serv 
erName"; 
                OdbcConnection Conn = new 
                OdbcConnection(connStr); 
                Conn.Open(); 
                OdbcCommand command = new OdbcCommand("call 
TEST_STORED_PROC ('Param1',0);"); 
                command.Connection = Conn; 
                OdbcDataReader reader = 
command.ExecuteReader(System.Data.CommandBehavior.SequentialAcce 
ss); 
                Console.WriteLine("printing result"); 
                while (reader.Read()) 
                { 
                    for (int i = 0; i < reader.FieldCount; i++) 
                    { 
                        Console.Write(reader.GetValue(i)); 
                        Console.Write("\t"); 
                    } 
                    Console.WriteLine(""); 
                } 
                command.Dispose(); 
                Console.WriteLine("done"); 
            } 
 
            catch (Exception e) 
            { 
                Console.WriteLine(e.ToString()); 
                Console.WriteLine(e.StackTrace); 
            } 
        } 
    } 
}
Problem-Zusammenfassung:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL                                                          * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* Problem Abstract:                                            * 
*                                                              * 
* The parameters of a stored procedure call get corrupted      * 
* during                                                       * 
* the prepare phase when using the ODBC Interface to execute   * 
* the                                                          * 
* SQL with the ExecuteReader method.                           * 
*                                                              * 
*                                                              * 
*                                                              * 
* Client: Windows 2003 64 Bit, DB2 V9.1 FP6a 64 Bit            * 
*                                                              * 
* Server: remote zOS based DB2 8.1.5 database stored procedure * 
*                                                              * 
*                                                              * 
*                                                              * 
* How easy is problem to reproduce? Easy                       * 
*                                                              * 
*                                                              * 
*                                                              * 
* Problem Desc:                                                * 
*                                                              * 
* The ExecuteReader() method will produce unexpected results   * 
*                                                              * 
* depending on how the stored procedure uses the corrupted     * 
* stored                                                       * 
* procedure parameters.                                        * 
*                                                              * 
*                                                              * 
*                                                              * 
* Here is a c# program that uses ODBC interface that can       * 
* reproduce                                                    * 
* this defect:                                                 * 
*                                                              * 
* using System;                                                * 
*                                                              * 
* using System.Collections.Generic;                            * 
*                                                              * 
* using System.Text;                                           * 
*                                                              * 
* using System.Data.Odbc;                                      * 
*                                                              * 
* using System.Data.OleDb;                                     * 
*                                                              * 
*                                                              * 
*                                                              * 
* namespace testDB                                             * 
*                                                              * 
* {                                                            * 
*                                                              * 
* class Program                                                * 
*                                                              * 
* {                                                            * 
*                                                              * 
* static void Main(string[] args)                              * 
*                                                              * 
* {                                                            * 
*                                                              * 
* string cmdstr = "";                                          * 
*                                                              * 
* if (args.Length > 0)                                         * 
*                                                              * 
* {                                                            * 
*                                                              * 
* cmdstr = args[0];                                            * 
*                                                              * 
* }                                                            * 
*                                                              * 
* TestODBCDB2(cmdstr);                                         * 
*                                                              * 
* }                                                            * 
*                                                              * 
*                                                              * 
*                                                              * 
* static void TestODBCDB2(String cmdstr)                       * 
*                                                              * 
* {                                                            * 
*                                                              * 
* // create and open a new connection                          * 
*                                                              * 
* try                                                          * 
*                                                              * 
* {                                                            * 
*                                                              * 
* // open the connection                                       * 
*                                                              * 
* Console.WriteLine("Openning                                  * 
* connection....");                                            * 
* String connStr =                                             * 
*                                                              * 
* "DSN=SAMPLE;UID=UserID;PWD=password;DATABASE=SAMPLE;WSID=serv 
*                                                              * 
* erName";                                                     * 
*                                                              * 
* OdbcConnection Conn = new                                    * 
*                                                              * 
* OdbcConnection(connStr);                                     * 
*                                                              * 
* Conn.Open();                                                 * 
*                                                              * 
* OdbcCommand command = new OdbcCommand("call                  * 
*                                                              * 
* TEST_STORED_PROC ('Param1',0);");                            * 
*                                                              * 
* command.Connection = Conn;                                   * 
*                                                              * 
* OdbcDataReader reader =                                      * 
*                                                              * 
* command.ExecuteReader(System.Data.CommandBehavior.SequentialAc 
* ss);                                                         * 
*                                                              * 
* Console.WriteLine("printing result");                        * 
*                                                              * 
* while (reader.Read())                                        * 
*                                                              * 
* {                                                            * 
*                                                              * 
* for (int i = 0; i < reader.FieldCount;                       * 
* i++)                                                         * 
* {                                                            * 
*                                                              * 
* Console.Write(reader.GetValue(i));                           * 
*                                                              * 
* Console.Write("\t");                                         * 
*                                                              * 
* }                                                            * 
*                                                              * 
* Console.WriteLine("");                                       * 
*                                                              * 
* }                                                            * 
*                                                              * 
* command.Dispose();                                           * 
*                                                              * 
* Console.WriteLine("done");                                   * 
*                                                              * 
* }                                                            * 
*                                                              * 
*                                                              * 
*                                                              * 
* catch (Exception e)                                          * 
*                                                              * 
* {                                                            * 
*                                                              * 
* Console.WriteLine(e.ToString());                             * 
*                                                              * 
* Console.WriteLine(e.StackTrace);                             * 
*                                                              * 
* }                                                            * 
*                                                              * 
* }                                                            * 
*                                                              * 
* }                                                            * 
*                                                              * 
* }                                                            * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to DB2 V9.7 FP3 or use the circumvention given       * 
****************************************************************
Local-Fix:
Do not use the Executereader method.  Prepare and execute the 
SQL statement that calls a stored procedure separately.
verfügbare FixPacks:
DB2 Version 9.7 Fix Pack 3 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 3a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 4 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 5 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 6 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 7 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 8 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 10 for Linux, UNIX, and Windows

Lösung
Problem was first fixed in Version 9.7 Fix Pack 3
Workaround
keiner bekannt / siehe Local-Fix
Weitere Daten
Datum - Problem gemeldet    :
Datum - Problem geschlossen :
Datum - der letzten Änderung:
29.06.2010
21.10.2010
21.10.2010
Problem behoben ab folgender Versionen (IBM BugInfos)
9.7.FP3
Problem behoben lt. FixList in der Version
9.7.0.3 FixList
9.7.0.3 FixList