2012-03-09 5 views
0

にCLOBに書き込み今、私たちは(作成するためのすなわち).csvファイルにデータを書き込むために、次のコードを使用しているJavaの

しかし、今、私は1つのデータベース列CLOBに直接データを更新する必要があります。 .csvファイルを生成しないでください。

どのようにこのデータをCLOBに追加できますか。 ここでは、すべての行をvectorとしてwriteIT()に渡し、それをfilewriterに追加しています。

CLOBに書き込むにはどうすればよいですか? ..

writeIt(mlh); 
<Loop> 
writeIt(row); 
<End Loop> 
writeIt(null); 
writeIt(commentLineHeader); 
<Loop> 
writeIt(row); 
<End Loop> 

protected void writeIt (Vector a){ 

if (filewriter==null) return; 
    try { 

     if (a!=null){ 
     for (int i=0;i<a.size();i++){ 
      //Object o=a.elementAt(i); 
      Object o=a.elementAt(i); 
      if (o!=null) { 
       String str=o.toString(); 
       // replacing an komma inside a string with a point. 
       str = str.replace(',','.'); 
       // replacing a new line in hexa it's 0A and 0F with blank 
       str = str.replace('\n',' '); // LF replace 
       str = str.replace('\r',' '); // CR replace 
       filewriter.write(str); 



      } 
       if (i!=a.size()-1) filewriter.write(","); 

      } 
     } 

    } 
    catch (IOException e){ 
     errH.addMessage(L_ERROR,"_$EXCEPTION_RAISED -" + e.toString()); 

     PAVSessionManager.getInstance().update_in_use_flag(); 

    } 
    } 

答えて

0

私を助けてくださいあなたは、Writerオブジェクトへの参照を取得するためにclob.setCharacterStream(int)を呼び出し、その後connection.createClob()を呼び出すことによって、作家にそしてちょうど作家、あなたのコンテンツをClobオブジェクトを作成することができ、それはそれです。