Results 1 to 2 of 2

Thread: DB2 CLOB data

  1. #1
    Join Date
    Jun 2005
    Posts
    19

    DB2 CLOB data

    Hi
    I need to insert the contents of a text file(say the complete file) into a CLOB column in Db2. How do we do that .Can anyone give me some idea. someone plz help!!!!!!!!
    Last edited by Naive; 08-25-2005 at 02:01 AM. Reason: change

  2. #2
    Join Date
    Sep 2005
    Posts
    2
    Hi Naive,

    You have several choices

    1) Use the import utility (easiest one)
    For example, if you have the table
    create table t1 (c1 int, c2 char(30), c3 clob(1M))

    you define a data file (data.txt) with for instance the folowing content:

    1,"uno" , name_of_the_file1
    2,"dos" , name_of_the_file2
    3,"tres", name_of_the_file3
    ........................
    then execute

    db2 IMPORT FROM data.txt OF DEL
    MODIFIED BY LOBSINFILE
    INSERT INTO T1

    2) Use programming, if for instance you want to use Embedded SQL you have 3 methods, the best for you case would be File Reference Variables, take a look of Manual (Application Development Guide - Programing Client Applications) for a detailed explanation,
    You can also use JDBC.

    Hope this helps!

    Luis Reina

Posting Permissions

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