users
[Top] [All Lists]

Re: [cinjug-users] insert and update CLOB data into Oracle 10g

To: "Akalamkam, Pardha" <Pardha.Akalamkam@xxxxxxxxxxxxxxxx>, users@xxxxxxxxxx
Subject: Re: [cinjug-users] insert and update CLOB data into Oracle 10g
From: Abdul Habra <ahabra@xxxxxxxxx>
Date: Thu, 31 May 2007 12:39:25 -0700 (PDT)
Delivered-to: mailing list users@xxxxxxxxxx
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=2iwBdg2JxeDZzXjmPglMKK+fWu0zZO2juOILNAdo1bJs685n5DfgpYWtj05ITXsNAan+RSvBBi4Oa/6sOlAjVld7gq/FkFW/lrC3ApMChZ3VFhpswmqsVe21OtLnuqdgFiVQBR3+iMF3WV1/uh0CKeIUJOXI/y1c6IPsdA3tqIg=;
In-reply-to: <F90E5F92AFD1934CBFAB75AB8FC87E07BBFC7C@xxxxxxxxxxxxxxxxxxxxxxx>
Mailing-list: contact users-help@xxxxxxxxxx; run by ezmlm
I see that u have been having some troubles with clob stuff.
I have developed an open source library that include code to read/write clobs and blobs.
 
 
look at the java docs for the class you want at:
The class com.tek271.util.db.ClobUtil.java contains methods that should make it easy for you to handle clobs.


"Akalamkam, Pardha" <Pardha.Akalamkam@xxxxxxxxxxxxxxxx> wrote:
Hi
  I am getting problems in updating CLOB data into oracle data base. I am using JNDI to get data source references (applicatin runs in web sphere)
 
following is the code. (I took out try, catch blocks to reduce number of lines). The code fails at clobstmt.executeQuery(); if I use FOR UPDATE in the SQL query. It works fine If I use only select statement without for update clause.
(earlier I inserted an empty CLOB and now I am trying to update the CLOB).
 
clobstmt = dbConnection.prepareStatement("SELECT MSG_XML_TXT FROM AFP_RTIME.PNDG_PLCY_HLDNG where PLCY_ID=? FOR UPDATE");
   clobstmt.setString(1,"02345668");
   clobstmt_rs = clobstmt.executeQuery();
   if (clobstmt_rs.next()) {
   clob = (CLOB)clobstmt_rs.getClob("MSG_XML_TXT") ;
     Writer w = null;
   //get the writer from the clob (locator)
   w = clob.getCharacterOutputStream();
    //write the page text
   w.write(clobData);
   System.out.println("data written to clob");
 
    //flush and close
   w.flush();
   w.close();
  }
 
can anyone provide suggestions.
 
Pardha

    



Thank You,
Abdul Habra


Park yourself in front of a world of choices in alternative vehicles.
Visit the Yahoo! Auto Green Center.
<Prev in Thread] Current Thread [Next in Thread>