Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Location
    VA,USA
    Posts
    8

    Post Unanswered: Inserting Large Text File into BLOB Cloumn

    HI,
    Could anyone tell me the way to insert a "FILE" into a BLOB Column of a Table in DB2 UDB 7.1.
    I don't want to insert any image file, I want to store a big Text file into the column.

    regards,
    Arvind

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Inserting Large Text File into BLOB Cloumn

    Here's a bit of the C++ code which was available on the IBM website ..

    //
    // insertPicture
    // - uses a prepared statement to insert a blob in table emp_photo
    //

    public static void insertPicture (Connection con, String empNo, String picFormat, FileInputStream fis, int maxFileSize) {
    try {
    PreparedStatement pstmt = con.prepareStatement("INSERT INTO emp_photo (empno, photo_format, picture) " +
    "VALUES (?, ?, ?)");
    // provide values for prepared statement and execute update
    pstmt.setString (1, empNo);
    pstmt.setString (2, picFormat);
    pstmt.setBinaryStream (3, fis, maxFileSize);
    pstmt.executeUpdate();
    pstmt.close();
    } catch (Exception e) { e.printStackTrace(); }
    }

    HTH

    Cheers

    Sathyaram


    Originally posted by arvind_tcs
    HI,
    Could anyone tell me the way to insert a "FILE" into a BLOB Column of a Table in DB2 UDB 7.1.
    I don't want to insert any image file, I want to store a big Text file into the column.

    regards,
    Arvind

Posting Permissions

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