Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2011
    Posts
    10

    Question Unanswered: Insert Blob data to DB2 by .net

    Hello every body !

    How can I insert blob data to DB2 by .Net?


    DB2Connection d2Conn = new DB2Connection();
    d2Conn.ConnectionString = "Server=192.168.1.107:50000;Database=dbtest;UID=db 2admin;PWD=db2admin";
    d2Conn.Open();

    DB2Command d2Command = new DB2Command();
    d2Command.Connection = d2Conn;
    d2Command.CommandType = CommandType.StoredProcedure;
    d2Command.CommandText = "PROFILE_ADD";

    List<DB2Parameter> list = new List<DB2Parameter>();
    DB2Parameter p1 = new DB2Parameter();
    p1.ParameterName = "v_ID";
    p1.Value = "0000000001";
    p1.DB2Type = DB2Type.Graphic;
    p1.Size = 10;
    list.Add(p1);

    DB2Parameter obj2 = new DB2Parameter();
    obj2 .DB2Type = DB2Type.Blob;
    obj2 .ParameterName = "v_FileContent";

    FileStream fs = new FileStream("C:\Text.txt", FileMode.OpenOrCreate, FileAccess.Read);
    byte[] MyData = new byte[fs.Length];
    fs.Read(MyData, 0, System.Convert.ToInt32(fs.Length));

    fs.Close();

    obj2.Value = MyData;

    d2Command.Parameters.AddRange(list.ToArray());
    d2Command.ExecuteNonQuery();

    When run that source code, the error "ERROR [57011] [IBM][DB2/NT] SQL0930N There is not enough storage available to process the statement. SQLSTATE=57011" has been throw.

    How can I fix this error? Please help me!!!!!!

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    in the sample directory there is a sample with some remarks - maybe this will help
    ** SOURCE FILE NAME: DtLob.cs
    **
    ** SAMPLE: How to use the LOB data type with the DB2 .Net Data Provider
    **
    ** Before running this sample, ensure that you set the database
    ** manager configuration parameter UDF Shared Memory Set Size
    ** (udf_mem_sz) to at least two pages more than the larger
    ** of the input arguments or the resulting CLOB being retrieved.
    **

    best regards, guy
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Jul 2011
    Posts
    10
    Quote Originally Posted by przytula_guy View Post
    in the sample directory there is a sample with some remarks - maybe this will help
    ** SOURCE FILE NAME: DtLob.cs
    **
    ** SAMPLE: How to use the LOB data type with the DB2 .Net Data Provider
    **
    ** Before running this sample, ensure that you set the database
    ** manager configuration parameter UDF Shared Memory Set Size
    ** (udf_mem_sz) to at least two pages more than the larger
    ** of the input arguments or the resulting CLOB being retrieved.
    **

    best regards, guy
    Thanks !!!!!!!!!!!!!!!!!!!!!!!!!!!

Posting Permissions

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