users
[Top] [All Lists]

insert and update CLOB data into Oracle 10g

To: <users@xxxxxxxxxx>
Subject: insert and update CLOB data into Oracle 10g
From: "Akalamkam, Pardha" <Pardha.Akalamkam@xxxxxxxxxxxxxxxx>
Date: Thu, 31 May 2007 11:50:51 -0700
Delivered-to: mailing list users@xxxxxxxxxx
Mailing-list: contact users-help@xxxxxxxxxx; run by ezmlm
Thread-index: AcejtJxJIuavs/wwR2Oz48Ck/CyM/w==
Thread-topic: insert and update CLOB data into Oracle 10g
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

    
<Prev in Thread] Current Thread [Next in Thread>