Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2002
    Posts
    6

    Unanswered: Error while trying to insert into BLOB field (or Long VarChar for BIT Data) in DB2

    I am currently trying to insert an image (the image is streamed) into DB2 using the IBM DB2 ODBC driver, and I am getting the following error.

    [IBM][CLI Driver][DB2/NT] SQL0352N An unsupported SQLTYPE was encountered in position "1" of
    the input list (SQLDA). SQLSTATE=56084

    I am using Delphi 5 and ODBCExpress and here is the sample code:

    TOracle,TDB2: begin
    mDestQ2.Statement.BlobPlacement := bpByParts;
    mDestQ2.Statement.BlobSize := MS.Size;
    mDestQ2.Statement.Prepare;

    GetMem(RawData,MS.Size);
    try
    MS.Seek(0,0);
    mDestQ2.Statement.BindParamCore(1, SQL_C_BINARY, RawData, SQL_LONGVARBINARY);
    mDestQ2.Statement.ParamSize[1] := MS.Size;
    MS.Read(RawData^,MS.Size);
    mDestQ2.Statement.Execute;
    finally
    FreeMem(RawData,MS.Size);
    end;
    end;
    TMSSQL: begin
    mDestQ2.Statement.Prepare;
    mDestQ2.Statement.BindBinary(1,MS);
    mDestQ2.Statement.Execute;
    end;

    The server is DB2 Version 7.2 FixPak 8, and I am binding the streamed blob to a parameter in the INSERT statement. It works perfectly for Oracle and MS SQL Server but, I am struggling to get it to work for DB2.

    The INSERT statement looks like this:

    INSERT into MT02_Media(MediaUID,CRC,MediaSize,mediaBlob)
    VALUES(1,100200,1000,?)

    And the structure of the table is:

    CREATE TABLE MT02_Media(
    MediaUID INTEGER NOT NULL,
    CRC VARCHAR(50),
    MediaSize INTEGER,
    MediaBlob LONG VARCHAR FOR BIT DATA,
    CONSTRAINT PK2 PRIMARY KEY (MediaUID)
    )
    ;

    As I said, I tried changing the field type to BLOB but I received the same error.

    Has anyone experienced this before or know what I am doing wrong?

    Thanks in advance for any help.

  2. #2
    Join Date
    Feb 2002
    Posts
    6
    I just want to let everyone know that I found the problem. I was using the DB2 ODBC driver version 8.1 locally and the server is DB2 version 7.1... once I switched my local driver to 7 then it worked fine.

    So I am not totally sure if it is a problem with the version 8 of the DB2 ODBC driver or the combination of the two versions that caused the problem.

  3. #3
    Join Date
    Aug 2003
    Posts
    2

    Question how do you know the driver version?

    Originally posted by Mike Ryksen
    I just want to let everyone know that I found the problem. I was using the DB2 ODBC driver version 8.1 locally and the server is DB2 version 7.1... once I switched my local driver to 7 then it worked fine.

    So I am not totally sure if it is a problem with the version 8 of the DB2 ODBC driver or the combination of the two versions that caused the problem.

    Question: I am facing the same problem. How does one know what version the driver is for? I have SQLDB2V5.dll and SQLDB232.dll on my mchine and both files show version 5.2.0.2. Now how does one know whether these drivers are for version 7 or for version 8?

  4. #4
    Join Date
    Feb 2002
    Posts
    6
    Go to your ODBC Data Source Adminstrator and click on the Drivers tab. Scroll down until you find the DB2 driver and the version will be listed.

  5. #5
    Join Date
    Aug 2003
    Posts
    2

    how do you know the driver version?

    Originally posted by Mike Ryksen
    Go to your ODBC Data Source Adminstrator and click on the Drivers tab. Scroll down until you find the DB2 driver and the version will be listed.
    I looked at the BDE Administrator, ODBC drivers, DB2, and checked out the file version which says 5.2.0.2. What it does not tell me is whether this driver is for version DB2 ver 7 or DB2 version 8? How did you find that out? Also from where can I get the driver for DB2 ver 7, if the one I have is for DB 2 ver 8?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •